Monday, July 21, 2008

Formulas for third and forth degree polynomials

In a previous post, the hunt for the roots, I showed how to develop the formula for the second degree polynomial. In this post I want to develop the formulas for the third and forth degree. Unfortunately this means that this whole post will be algebra and nothing else. This formulas were originally developed in the 16 century - you can read more about this in the post linked above.
A little warning - in this post I don't solve numerical examples, so I use letters to denote numbers that would be known in a numerical example, but I freely move them around. This means that if in one line I wrote bx, in the next line I will also write bx even if I should write (b+4)x instead, and the same with the sign of b. To use the formulas you will need to follow the simplification process, and then to aplly the final formula to the result.

Lets start. The idea is to get the general formula for the equation of the form:

$ax^3+bx^2+cx+d=0$

Firstly, lets get rid of as many parts as we can. By dividing it by a (it cannot be zero, because then we have a second degree equation) we will get a simpler equation. But it is possible to make it even simpler. To do this lets suppose that x=y-b/3 (b is not the original b, but the original b divided by a). After dividing by a, and writing y-b/3 instead of x we will get an equation of the form:

$y^3+by+c=0$

Writing this step fully requires too much typing, so it is skipped. You can easily verify it yourself. Now we will write this equation in a slightly different way:

$x^3+bx=c$

Lets suppose that x=u-v (this step is called uglification):

$(u-v)^3+b(u-v)=c$
$u^3-v^3-3u^2v+3uv^2+b(u-v)=c$
$u^3-v^3+(u-v)(-3uv)+b(u-v)=c$
$u^3-v^3+(u-v)(b-3uv)=c$

We can choose u,v so that b-3uv=0. Now we get two equations:

$u^3-v^3=c$ ,

But those are simple second degree equations, to see this just substitute u^3=t, v^3=s. It is easy to solve and get that:

v^3=

u^3=

Now all we need is to get the solution, x=u-v, is to take the third root. After this we get a rather unpleasing formula, which is however the solution. It might seems surprising that it took so much time to get to this formula (over 1000 years), but lets not forget that it seems relatively simple because of the modern notation. In the ancient world they were without symbols, all they had were words. For us the process is visual, but it wasn't so for them. Note that this formula should be used only after you did the previous steps - that is after you have simplified the equation to the form before the uglification step.

Now to the forth degree. We need to solve an equation of the form:

$ax^4+bx^3+cx^2+dx+e=0$

The first step is to use the same method I used in solving the third degree polynomial, to reduce the problem to:

$x^4+bx^2+cx+d=0$

This reduction can always be done, it is easy to check but requires a lot of typing in latex to show it here, so I am skipping this. Lets complete the equation to a square, and move the rest to the second side (since c,d are unknown numbers, we can ignore the sign):

$x^4+2x^2+1=(2-b)x^2+cx+d$
$(x^2+1)^2=bx^2+cx+d$

Now, if only the left side was a square.... Well, it is again time for uglification. Lets look on:

$(x^2+1+y)^2$=
$(x^2+1)^2+y^2+2y(x^2+1)$=$bx^2+cx+d+y^2+2y(x^2+1)$=$(2y+b)x^2+cx+d+y^2+2y$

Now, when this will be a perfect square? The answer is simple. We need the discriminant to be equal zero. This means that:

$c^2=4(2y+b)(d+y^2+2y)$

This is a third degree equation. Now, isn't it great that we have a way to solve a general third degree equation? Without knowing a solution to the third degree polynomial we wouldn't be able to solve this... Now, lets suppose that (t) is a solution. Than we can write the original equation as:

We can now take the root and get the simple equation:

$x^2+1+t=x-t$ and $x^2+1+t=t-x$

This is second degree, so the solution is easy.

Now, this is the part where I apologize for the misleading title - as you can see, while I developed the general way of solving the third and forth degree equations, I didn't write down the formulas. This is because they are nether useful nor nice to write (the formula for the forth degree is huge). I once was told that solving second degree equation using the formula takes 5 minutes for the third degree it takes one day, and for the forth a week. This is not true but it is close. However, all you need to write the final formula is in the post, you just need to write it down. If you are interested in the formulas themselves here are links to them: Third degree, Forth degree.

Anonymous said...

Sjoerd said...

Very short and insightful explanation. Thanks.

I was wondering if I saw two little mistakes:
1) the formula for the third degree with u^3*v^3 = b/27 migth be u^3*v^3 = b^3/27

2) in the formula for the fourth degree you would get
(x^2+1+t)^2 = (x-u(t))^2
because on the left side you can replace 'y' with its solution 't', but on the right side you will have a perfect square but the solution is in general (x-u(t))^2 where u is a constant that is derivable from the solution t.

Al said...

Thank You !!!

Al said...

There is small misprint
there should be u^3 v^3= b^3/27.
now it is written b/27 - cub is forgotten.

Nicolai said...

Nice work, however it seems to me that there is an error in the 3'rd degree formula. It is assumed that
b-2uv=0.
This implies
u³v³=b³/27 and not
u³v³=b/27
which is repeated in the following formulas.

Anatoly said...

Thanks for noticing that it should be b^3. Sorry for taking so long to fix it, the program I used to make the formulas no longer works so I needed to find another way, and this took time.

Sjoerd, I don't think that in the formula for the fourth degree I should get u(t). Originally y is a constant which I need to determine. I get a third degree equation for y for which t is a solution. So from now on y=t. Basically on this step we choose y to be t. There is however a mistake on this step, it should not be x-t, because t is not a solution of the square on the right. I fixed this as well, thanks for noticing that this line was wrong.

nick said...

I need one that shows the steps please. sorry about the symbols, but I wanted to make sure it was clear that I wanted a calculator for this, some people didn't understand that.

Actually, is a calculator to calculate simplest polynomial functions with given roots even possible?

Anatoly said...

I am not sure what you mean. If the roots are given you can get the corresponding polynomial by multiplying the correct factors.For example:
(x-3)(x-2)=x^2-5x+6
This is the simplest polynomial with the roots 2 and 3.