Polynomial Equations - Cardano v9
Polynomial Equations - Cardano v9
Internal Assessment
Table of Contents
1
INTRODUCTION....................................................................................................1
Cardano's Method....................................................................................................3
Discriminants.............................................................................................................7
Iterations.................................................................................................................13
CONCLUSION.......................................................................................................15
6
Appendix A : Excel VBA code written to solve the cubic equation
x3+ax2+bx+c=0................................................................................................................16
6.1
6.2
6.3
Bibliography...........................................................................................................19
INTRODUCTION
At the early days of high school I was impressed to see that solutions to problems could
be found by solving linear equations of the form ax+b=0 where a and b ..
One such easy problem was the calculation of the time it takes to travel a distance
S=100km when travelling at a speed of V=120 km/h
We have S=Vt This can be rearranged so Vt-S=0.
Therefore:
S 100
t= =
h=0.83 h
V 120
This indeed looks simple now but at the time it was a revelation.
I then started my IB course and suddenly I learned how to solve quadratic equations. I
also learned that both of these equations are polynomial equations of 1st and 2nd degree.
The question that stacked in my mind was how polynomial equations of higher degree
are solved.
In this work I aim to find out how the cubic equation of the form Zx3+Ax2+Bx+C=0 is
solved.
But let us start with the definition of the polynomial and the polynomial equation.
Any expression of the form
n
P( x)= ai x
i=0
= b2 4ac
(2)
If the roots of the equation is x1 and x2 then,
b b b 24 ac
x 1 , x 2=
=
2a
2a
(3)
21
Babylonian Mathematics :
http://en.wikipedia.org/wiki/Babylonian_mathematics
manuscript : http://www-history.mcs.stand.ac.uk/Projects/Pearce/Chapters/Ch6.html
The Bakhshali
Cardano's Method
If we divide the equation Zx3+Ax2+Bx+C=0 with Z where Z0, we end up with the
general form of the cubic equation as follows:
x3 + ax2 + bx + c = 0 where a, b, c and d
x= y
After substituting
a
3
(4)
a 3
a 2
a
+ a y +b y +c
3
3
3
) (
) (
2 ya a
+
+c
3
3
3
a
3
2a
y 3 y +
+a
3 3
()
()
y +
a2 2 a2
a3 a3 ab
y +
+b y +
+ +c
3
3
27 9 3
3
y 3+
) (
a
2 a ab
+b y+
+c =0
3
27
3
By substituting
) (
p=
a 2
2 a3 ab
+b q=
+c
3
27
3
) (
(5)
, (5) becomes:
y3 + py + q = 0
(6)
( u+ v )3 + p ( u+ v )+ q
3
u +3 u v +3 uv + v + pu+ pv +q
(7)
u3 + v3 + q +(u+v)(3uv + p) = 0
(8)
In order for equation (7) to be valid the following must be also valid.
3uv + p = 0 and u3 + v3 = -q.
Candidate Number: 00******
In this way, we obtain the system with equations (9) and (10) below.
u3 + v3 = -q
u3 v 3=
(9)
p 3
27
(10)
Since this system specifies both the sum and product of u3 and v3, we can define a
quadratic equation with roots u3 and v3. This equation will be:
p3
(11)
t 2 + qt =0 Where t .
27
As Cardano did not know complex numbers, he supposed that the roots of this equation
were real. This meant that his method was looking only for real solutions. In order for
this to be true the following had to be true.
0 Hence:
q 24
p 3 2
p3
=q + 4 0
27
27
(12)
This meant that equation (11) has the following distinct solutions t1 and t2:
q q2 +
t 1,2 =
4 p3
27
where t1 and t2
q
q2 p3
+
2
4 27
(13)
u3=
q
q2 p3
+
+
2
4 27
v 3=
q
q 2 p3
+
2
4 27
u=
q
q p
+
+
2
4 27
3 q
v=
q2 p3
+
4 27
where u and v .
Since we have set y=v+u we have:
y=
and since
x=
q
q 2 p3 3 q
q2 p3
+
+ +
+
2
4 27
2
4 27
x= y
2
a
3
where y .
we have:
q
q p 3 q
q p a
+
+ +
+
2
4 27
2
4 27 3
where
x .
4
Indeed another Italian Mathematician called Bombelli6 in 1560 solved this equation.
By applying the Cardano formula Bombelli came up with :
x=
3 2+ 121+ 3 2121
3 2+ 121=2+b 1
3 2+ 121=2 1
It was indeed the solution of the above equation that led 7 to the definition of
complex numbers.
In 1799 Gauss proved the fundamental theorem of Algebra8 which states that any
polynomial of degree grater or equal to 1 has at least 1 root which can be either real or
complex. The consequence of this theorem was the proof that every polynomial of n
degree has n roots if we allowed multiple roots to be counted distinctly.
Having now the knowledge of complex numbers and the understanding of the above
fundamental theorem of Algebra, we know that the cubic equation has in fact three
solutions with some of them real and some of them complex. In the following part of
this report, I will aim to locate the additional solutions not found by the Cardano
method.
Since u
= t1
(14)
Therefore:
(u3 t1 )=0
(15)
and
(16)
Cardanos solution was based on the solution of equation 15 where he found u1 and v1.
But if
u2,3=
3 t 1
( t ) 4 ( t ) = t i t 3 = t
2
(1 i 3 )
3 t 2
( t ) 4 ( t ) = t i t 3 = t
2
(1 i 3 )
Hence:
u2=
3 t1 (1+i 3 )
2
3
t
u = 1 (1i 3 )
3
3
t
v = 2 (1+i 3 )
2
3
t
v = 2 (1i 3 )
3
Since y=u+v and we have three u and three v we end up with 9 possible pairs u and
v the sum of which could be y. These pairs are summarised on table 1.
3.1
Discriminants
u v
n
un+vn
un . vn
1 u1
v1
2 u1
v2
v3
Complex since u1 is
Real and v3 is Complex
4 u2
v1
Complex since v1 is
Real and u2 is Complex
5 u2
v2
6 u2
v3
Complex since v1 is
Real and u3 is Complex
3 u1
7 u3
v1
8 u3
v2
9 u3
v3
In order for equation (10) above to be valid since p is real, un . vn must also be real.
Therefore from the above pairs we discard the pairs 2, 3, 4 and 7 since they are
complex.
We now have to do the calculations for pair 5, 6, 8 and 10 to find the ones that satisfy
un . vn
3 t 1 =m and 3 t 2 =n
2
For pair Nr 6.
s assume that onal solu
u2 . v 3=(m+ 3 ) (ni . n 3 ) =( mn+ 3 mn ) +i 3 ( mnmn ) =2mn n
This is real, as both m and n are real.
In the same way the product of pair 9 is also complex and the product of pair 8 is real
Therefore since y=v+u and
additional solutions of
x= y
a
3
x.
a
a
x 2=u2 +v 3 =mn+i 3 ( mn )
3
3
3
3
t 1 3 t 2 a
t 1 3 t 2
+i 3
(15)
3
3
a t 1 t 2 a
3 t 1 3 t2
x 3=u3 + v2 =
i 3
3
2
2 3
2
2
(16)
We therefore conclude that if >0 we have one real solution that is given by the Cardano
formula and two additional complex solutions.
q 3 q a
a
3 q
+
=2
2
2 3
2 3
(17)
q a 3 q a
=
2 3
2 3
(18)
Hence from the above, if =0, we have 3 real solutions and two of them are equal.
q
q p
p
t 1,2 =
i +
=
(cos isin)
3
2
4 27
3
(19)
q
2
( )
Where =arccos
p
27
(18)
Using now De Moivre's9 formula we can calculate the 3 roots of t1 and t2 which are
equal with y1, y2 and y3.
Hence for k=0, 1 and 2 we have:
1
3
y 1,2,3= ( t 1 ) =
3
p
( cos ( +2 k ) +isin(+ 2 ) ) =
3
3
p 3
( cos ( +2 ) +isin ( +2 ) ) 3 =
3
3
( (
(
(
(
p
+2
+2
cos
+isin
3
3
3
) (
))
(20)
( ) ( ))
p
+ 2
+ 2
y=
cos (
+isin (
=
)
3
3
3 ))
y 1=
cos
+isin
3
3
3
y 3=
p
+4
+4
cos
+isin
3
3
3
) (
))
(21)
(22)
By using the (-) sign of equation (19) we get 3 more values of y which are:
9 http://en.wikipedia.org/wiki/De_Moivre's_formula
Candidate Number: 00******
10
(
(
(
y4 =
cos
isin
3
3
3
y 5=
p
+2
+ 2
cos
i sin
3
3
3
y 6=
( ))
()
(23)
))
p
+4
1
+ 4
cos
i sin
3
3
2
3
and
(24)
))
(25)
Since x is the sum of the roots that come from t1 and t2 of equation (15) we get 9 pairs of
y and hence 9 values of x. Out of these we keep the 3 real values, which are the
following.
x 1= y 1+ y 4=2
x 2= y 2+ y 5=2
x 3= y 3 + y 6=2
p
a
co s
3
3 3
(26)
p
+ 2 a
cos
3
3
3
(27)
p
+4
a
cos
3
3
3
(28)
()
11
such equations is presented together with validation of the results (ensure that the result
becomes zero if the derived solutions are entered into the actual equation. .
Table 2 : Examples of solutions of the equation x3+ax2+bx+c=0 using the Extended
Cardano based developed Excel Functions
CARDAN1(a;b;c) , CARDAN2(a;b;c) , CARDAN3(a;b;c)
a
0.75
c
0.1875 0.015625
Imaginar
y part of
X2
Imagina
part of
11
-15
-4
-2
0.44225
0
-1.7211247852 +
i 1.2490247665
-1.72
1.25
-1.7211247852 - i
1.2490247665
-1.72
-1
10
-20
1.36880
8
-1.6844040539 +
i 3.4313313502
-1.68
3.43
-1.6844040539 - i
3.4313313502
-1.68
-3
-2
-1.0000000000 +
i 1.0000000000
-1.00
1.00
-1.0000000000 - i
1.0000000000
-1.00
-1
2.00
3.0000000000 - i
2.0000000000
3.00
-2
2.0000000000 - i
1.0000000000
2.00
-1
-4
26
-7
17
-15
3.00000
0
0.75
0.1875 0.015625
11
-15
-4
-2
10
-20
-2
-4
26
-7
17
-15
x3
Real
part of
X2
x1
0.25000
0
1.00000
0
4.00000
0
1.00000
0
1.00000
0
2.00000
0
x2
Real
part of
X2
0.250000
0.25
0.00
0.250000
0.25
-1.000000
-1.00
0.00
-2.000000
-2.00
4.000000
4.00
0.00
-0.267949
-0.27
-1.000000
-1.00
0.00
-1.000000
-1.00
3.0000000000 + i
2.0000000000
3.00
2.0000000000 + i
2.00
1.00
1.0000000000
Validation of the solutions
0.00000
0
0.00000
0
0.00000
0
0.00000
0
0.00000
0
0.00000
0
0.00000
0
0.00000
0
0.00000
0
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.00000
0
0.00000
0
0.00000
0
0.00000
0
0.00000
0
0.00000
0
0.00000
0
0.00000
0
0.00000
0
12
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
Iterations
If the Cardano based solution was not available then the only available alternative
would be to solve the 3rd degree polynomial using one of the iteration methods. One
such method is the Newton Raphson method. Defined as follows:
x n+1=x n
f ( x n)
f ' (x n )
Where
f (x) . (28)
It is beyond the scope of this report to investigate the Newton Rapson method or any
other iteration method. The general philosophy of the iteration methods is is to
assume an initial value x1. Using then the iteration formula, in the case of Newton
Rapson method the formula (28) above, the values of x2, x3 and so on can be
calculated. Providing that the iteration sequence converges to a number, this number
gives the required solution.
What is important with the different iteration methods is their convergence behavior
(i.e do they converge every time despite the initial guess or not, are there convergence
criteria that can be identified?), their convergence speed and the error in calculating
the required solution.
In the case of the Newton Rapson method, since the iteration formula depends on the
derivative of the function and the function in this case is a 3rd degree polynomial, it is
easy to calculate the derivative and hence come up with the iteration formula.
x n+1=x n
x 3+ a x2 +bx +c
3 x 2 +2 ax+ b
(29)
Full analysis of the Newton Rapson method or any other iteration method is beyond
the scoop of this internal assessment report. However, having the curiosity to see how
the Newton Rapson method works few examples were calculated and are presented in
the following table 3.
In the 1st example it converges after 35 iterations while on the 2nd and 3rd after 9 and 7
respectively.
The limitations that seem apparent with this method are:
The solution appears to be connected with the initial guess.
It is not understood how the initial guess should be made. A computer program
can be written which can loop using initial guesses from x to +x with steps of
p. both x and p need to be specified following further analysis.
The calculations are cumbersome. Computer programs can be written however
that solves this issue.
13
14
FX
A
DFX
FX
DFX
-0.75
0.187
5
0.015
6
3
2.083
33
1.472
22
1.064
81
0.5409744
45
1.99176
95
0.793
21
0.1602887
24
0.88523
09
0.612
14
0.0474929
55
0.39343
6
0.0140719
87
0.17486
04
6
3
1.378
38
0.320
01
0.351
2
0.747
2
0.939
6
0.995
2
0.0041694
78
0.07771
57
-1
0.0012354
01
0.03454
03
-1
0.009
67
6.8E05
3.5E09
0.0003660
45
0.01535
13
-1
0.0001084
58
0.00682
28
3.21356E05
0.00303
23
9.52166E06
0.00134
77
2.82123E06
0.00059
9
8.35921E07
0.00026
62
2.4768E07
0.00011
83
7.33867E08
5.259E05
2.17442E08
2.337E05
6.44273E09
1.039E05
1.90896E09
4.617E06
5.65617E10
2.052E06
1.6759E10
9.119E07
4.96564E11
1.4713E11
4.053E07
1.801E07
B
C
xi
1
6
7
8
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
0.491
43
0.410
95
0.357
3
0.321
53
0.297
69
0.281
79
0.271
2
0.264
13
0.259
42
0.256
28
0.254
19
0.252
79
0.251
86
0.251
24
0.250
83
0.250
55
0.250
37
0.250
20.796875
22.6875
6.1620370
37
10.0833
33
1.8257887
52
4.48148
15
FX
DFX
11
61
17.3
28
4.45
72
48
22.345
05
11.450
86
120
35.18
05
10.16
73
74
33.24
03
15.14
73
-2
3
1.729
17
0.953
7
2.833
4
7.155
44
0.564
46
0.82
91
7.3425
8
0.713
49
3.708
55
0.451
55
0.05
84
6.3209
68
0.131
99
2.373
42
0.442
31
0.00
04
6.2407
66
2.028
86
2.000
2
0.442
25
0.442
25
2E08
6.2402
51
6.2402
51
15
3
2
4
2
5
2
6
2
7
2
8
2
9
3
0
3
1
3
2
3
3
3
4
3
5
25
0.250
16
0.250
11
0.250
07
0.250
05
0.250
03
0.250
02
0.250
01
0.250
01
0.250
01
4.35942E12
8.006E08
1.29168E12
3.558E08
3.82722E13
1.581E08
1.13382E13
7.028E09
3.3612E14
3.124E09
9.94343E15
1.388E09
2.94903E15
6.176E10
8.8124E16
2.749E10
2.56739E16
1.216E10
0.25
7.63278E17
5.435E11
0.25
2.77556E17
2.44E11
0.25
8.818E12
CONCLUSION
I started with an historical review of solving equations of 1st, 2nd and 3rd degree. I was
impressed to find out that the Babylonians could solve quadratic equations in 1800
BC. As I was also impressed by the fact that the ancient Greeks had geometrical
methods to solve certain cubic equations.
When it came to 2nd degree polynomial equations I realized that the general solution is
so powerful, that not only it solves any 2nd degree polynomial equations, but the
existence of the discriminant gives information of how many solutions or roots the
equation has and whether these are real or complex numbers.
It was fascinating for me to discover that Cardano back in 1545 found a general
solution for the 3rd degree equation involving discriminant in a similar way to the
discriminant of the 2nd degree equation .
However as Cardano did not have a knowledge of complex numbers his formula gave
only one real solution when the discriminant was positive. At a later time with the
knowledge of complex numbers was solved completely according to the value of the
discriminant . I have named this general solution the Cardano extended solution.
In this report I validated the that if:
1. >0 we have 1 real and 2 complex solutions (the real solution was also
found by Cardano)
2. =0 we have 3 real solutions and at least 2 of them are equal
Candidate Number: 00*****
16
Finally comparing the two methods, the Cardano extended method and the iterations
method for solving the cubic equations using computers, the preferred alternative is
the Cardano extended method since it gives all solutions, real and complex without
the need of any initial guesses.
17
6.1
Dim pp As Double
Dim qq As Double
Dim DD As Double
Dim t10 As Double
Dim t100 As Double
Dim t20 As Double
Dim t200 As Double
Dim TH0 As Double
Dim 10 As Variant
Dim CS As Double
Const pi As Double = 3.1415926535897
pp = (bb - (aa ^ 2) / 3)
qq = 2 * (aa ^ 3) / 27 - aa * bb / 3 + cc
DD = (pp ^ 3) / 27 + (qq ^ 2) / 4
If DD < 0 Then
CS = ((-qq / 2) / ((-pp ^ 3 / 27) ^ (1 / 2)))
TH0 = Application.Acos(CS)
x10 = ((-pp / 3) ^ (1 / 2)) * 2 * Cos(TH0 / 3) - aa / 3
ElseIf DD = 0 Then
x10 = 2 * (-qq / 2) ^ (1 / 3) - aa / 3
Else
t10 = -qq / 2 + (DD) ^ (1 / 2)
If t10 > 0 Then t100 = (t10 ^ (1 / 3)) Else t100 = -((-t10) ^ (1 / 3)) 'VBA can not
calculate cubic root of (-ve)
t20 = -qq / 2 - (DD) ^ (1 / 2)
If t20 > 0 Then t200 = (t20 ^ (1 / 3)) Else t200 = -((-t20) ^ (1 / 3))
x10 = t100 + t200 - (aa / 3) ' this is the cardano formula solution
End If
Cardan1 = x10
End Function
6.2
18
19
20
Bibliography
21