The left triangle has an area of half the rectangle A * h. Since cos( a ) = A / b the area of the left triangle is 0.5 h A = 0.5 h b cos( a ). However h = a sin( b ). Finally resulting in the Area of the left triangle being 0.5 a b cos( a ) sin( b )
For the right triangle the same is true ( we use of course angle b and side a ). Thus the area of the right triangle is 0.5 h a cos( b ). Finally resulting in the Area of the left triangle being 0.5 a b cos( b ) sin( a )
This gives us the first formula for the area of the complete triangle which is:
0.5 a b ( cos( a ) sin( b )
+ cos( b ) sin( a ) ).
Now we are going to calculate the area of the complete triangle in a different way. Again we say the area of the comlete triangle is half that of the rectangle l * b. Thus Area = 0.5 * l * b. Since l = a * sin( g ). This results in the complete area being 0.5 * b * a * sin( g ). Since g = 180°  ( a + b ) we can write this as 0.5 * b * a * sin( 180  ( a + b ) ).
When we draw a sine function on paper we can see that sin( 180  Angle ) = sin( Angle ).
This gives 0.5 * b * a * sin( a + b ) as the area for the complete area.
Now since the first calculated area must equal the second (it is the same triangle after all).
0.5 * b * a * sin( a + b ) = 0.5 a b ( cos( a ) sin( b )
+ cos( b ) sin( a ) ).
Dividing by 0.5 * b * a gives us the wanted formula which will help a lot in the next chapters.
sin ( a + b ) = cos( b ) . sin( a ) + cos( a ) . sin( b )
However from this formula we can derrive an additional formula. When looking at the above formula the question arises if a similar formula exist with the cosine i.e. something like cos ( a + b ) = ... Well there is but I save you the trouble of going through 2 triangles and a lot of text. Instead we take a shortcut.
Lets say we define a = 90 + d. We can do this since we are not interested in absolute values but just in the "blueprint" of the formula.
sin ( 90 + d + b ) = cos( b ) . sin( 90 + d ) + cos( 90 + d ) . sin( b )
Since sin ( 90 + a ) = cos( a ) and cos ( 90 + a ) = sin( a ) ( draw a sine an cosine function on paper to proof this for yourself) this will finally result in the following formula.
cos ( d + b ) = cos( b ) . cos( d )  sin( d ) . sin( b )
We can then write the formula in the same way as at the beginning of the paragrap.
cos ( a + b ) = cos( b ) . cos( a )  sin( a ) . sin( b )
Of course this last a is not the same as before.
In the following paragraphs function Re() will return the real part of a complex number (see this as the Xaxe) and Im() will return the imaginary part of a complex number (see this as the Yaxe).
C1 = a + jb
C2 = c + jd
C3 = C1 + C2 = ( a + c ) + j ( b + d )
Re( C3 ) = a + c
Im( C3 ) = b + d
Substraction
C1 = a + jb
C2 = c + jd
C3 = C1  C2 = ( a  c ) + j ( b  d )
Re( C3 ) = a  c
Im( C3 ) = b  d
Multiplication
When we multiply two vectors we have to multiply the length of the vector and add the angles to get the resulting vector.
Mulitplication with polar coordinates
C1 = A1. ( cos( a ) + j sin( a ) )
C2 = A2. ( cos( b ) + j sin( b ) )
C1 * C2 = A1 * A2 ( cos( a )cos( b )  sin( a )sin( b ) + j( cos( a )sin( b ) + sin( a )cos( b ) )
Using the two formula's from the "handy section".
C1 * C2 = A1 * A2 ( cos( a + b ) + j sin( a + b ) )
So multiplying two vectors is multiplying their lengths and adding the angles. This can speed up calculations when raising a complex number to power 'n'.
Mulitplication with vectors
C1 = a + jb
C2 = c + jd
C3 = C1 * C2 = ( a * c + j^{2} * b * d ) + j ( a * d + c * b )
Since j^{2} = 1
C3 = C1 * C2 = ( a * c  b * d ) + j ( a * d + c * b )
Re( C3 ) = a * c  b * d
Im( C3 ) = a * d + c * b
Division
Division with polar coordinates
C1 = A1. ( cos( a ) + j sin( a ) )
C2 = A2. ( cos( b ) + j sin( b ) )
C1 / C2 = A1 / A2 ( cos( a ) + j sin( a ) )/( cos( b ) + j sin( b ) )
We are first going to multiply both parts with the complement of C2 (without the length). This is C2 with the imaginary part inverted. This way we get rid of the imaginary part in the denominator.
C1 / C2 = A1 / A2 ( cos( a ) + j sin( a ) )( cos( b )  j sin( b ) )/( cos^{2}( b ) + sin^{2}( b ) )
Since  sin( b ) = sin(  b )and cos( b ) = cos(  b ) and, very important, sin^{2}( b ) + cos^{2}( b ) = 1 since it is on the unit circle.
C1 / C2 = A1 / A2 ( cos( a ) + j sin( a ) )( cos(  b ) + j sin(  b ) )
Now we again have the formula for multiplication (only angle b is negative). Thus
C1 / C2 = A1 / A2 ( cos( a  b ) + j sin( a  b ) )
Conclusion division is dividing the lengths and substracting the angles.
Division with vectors
C1 = a + jb
C2 = c + jd
C3 = C1 / C2 = ( a + jb ) / ( c + jd )
C3 = C1 / C2 = ( c  jd ) /( c  jd ) ( a + jb ) / ( c + jd ) = ( ca + db  j( da  bc ) )/ ( c^{2} + d^{2} )
Re( C3 ) = ( ca + bd ) / ( c^{2} + d^{2} )
Im( C3 ) =  ( da  bc ) / ( c^{2} + d^{2} )
Power n
This is just a number of multiplications and won't be explained any further. For polar coordinates the formula is easy and efficient.
C1^{n} = A1 ( cos( na ) + j sin( na ) )
Since root 'n' equals power '1/n' we can write the same formula as with 'Power n'
C1^{1/n} = A1 ( cos( a / n ) + j sin( a/ n ) )
However this is only one solution. Also adding 360° to the angle give other solutions. Therefore the complete formula is:
C1^{1/n} = A1 ( cos( ( a + k 360 ° ) / n ) + j sin( ( a + k 360 ° ) / n ) )
Where k is in the range [ 0, n  1 ]
Now to use some of the above theory lets see how to calculate a mandelbrot fractal by hand. As you might remember form the previous chapters a mandelbrot fractal is defined as
Z_{n + 1}= Z_{n}^{2} + C
Where C is the current starting point. Lets try this a few times for C = 1 + j
First iteration:
Z_{n + 1} = ( 1 + j )^{2} + 1 + j
Z_{n + 1} = ( 1 + 2j  1 ) + 1 + j
Z_{n + 1} = 1 + 3j
Second iteration
Z_{n + 1} = ( 1 + 3j )^{2} + 1 + j
Z_{n + 1} = ( 1 + 6j  9 ) + 1 + j
Z_{n + 1} = 7 + 7j
Third iteration
Z_{n + 1} = ( 7 + 7j )^{2} + 1 + j
Z_{n + 1} = ( 49  98j  49 ) + 1 + j
Z_{n + 1} = 1  97j
Now stop when the vector reaches a certain size. The current size is ( 1^{2} + 97^{2} )^{1/2}
Lets say we stop at this point then we have to assign a color to this point for instance based on the current number of iterations which is three.
Then suddenly we realize that this is cumbersome to do by hand and decide to use frachunt instead.
