# Brahmagupta or Fibonacci Identity (comps)

Complex numbers participate in the two-square formula:

(a + ib)*(c + id) = (ac - bd) + i(bc + ad)
(a^2 + b^2)*(c^2 + d^2) = (ac - bd)^2 + (bc + ad)^2

The two-square identity is more general than shown above, as we can change polarity on input and output variables to achieve eight different implementations. These variations are the Brahmagupta or Fibonacci identities.

(a^2 + b^2)*(c^2 + d^2) = (+ac + bd)^2 + (+bc - ad)^2
(a^2 + b^2)*(c^2 + d^2) = (+ac + bd)^2 + (-bc + ad)^2
(a^2 + b^2)*(c^2 + d^2) = (+ac - bd)^2 + (+bc + ad)^2
(a^2 + b^2)*(c^2 + d^2) = (-ac + bd)^2 + (+bc + ad)^2
(a^2 + b^2)*(c^2 + d^2) = (-ac - bd)^2 + (-bc + ad)^2
(a^2 + b^2)*(c^2 + d^2) = (-ac - bd)^2 + (+bc - ad)^2
(a^2 + b^2)*(c^2 + d^2) = (-ac + bd)^2 + (-bc - ad)^2
(a^2 + b^2)*(c^2 + d^2) = (+ac - bd)^2 + (-bc - ad)^2

These variations all have the property that the magnitude of the product equals the product of the input magnitudes. These forms can also be derived from the standard complex number definition by various combinations of sign inversions on inputs and outputs. However, the multiplications rules above, with the exception of complex numbers and the negated complex numbers, are not traditional algebras with commutative and associative properties.

### Multiplication Table Format

We see above that in each expression we have three plus and one minus, or three minus and one plus. We can encode this rule in a generic multiplication table for real and imaginary components, using S(x,y) as a symbol for the sign of the product for row x and column y.

 1 i 1 S(0,0)*1 S(0,1)*i i S(1,0)*i S(1,1)*1

where S(1,1) = -S(0,0)*S(0,1)*S(1,0)

We have three independent variables. Thus, we have eight (2^3) different identities.