# Quartic function

The quartic function is the bridge between the cubic function and more advanced functions such as the quintic and sextic.

# Objective

* Present quartic function and quartic equation.
* Introduce the concept of roots of equal absolute value.
* Show how to predict and calculate equal roots, techniques that will be useful when applied to higher order functions.
* Simplify the depressed quartic.
* Show that the quartic equation is effectively solved when at least one root is known.
* Present the "resolvent" cubic function.
* Show how to derive and use the quartic formula.

# Lesson

Introduction
The quartic function is the sum of powers of $x$ from $0$ through $4$:
$y=f(x)=ax^{4}+bx^{3}+cx^{2}+dx^{1}+ex^{0}$
usually written as:
$y=f(x)=ax^{4}+bx^{3}+cx^{2}+dx+e.$
If $e==0$ the function becomes $x(ax^{3}+bx^{2}+cx+d).$
Within this page we'll say that:
both coefficients $a,e$ must be non-zero,
coefficient $a$ must be positive (simply for our convenience),
all coefficients must be real numbers, accepting that the function may contain complex roots.
The quartic equation is the quartic function equated to zero:
$ax^{4}+bx^{3}+cx^{2}+dx+e=0$.
Roots of the function are values of $x$ that satisfy the quartic equation.
Because the function is "quartic" (maximum power of $x$ is $4$), the function contains
exactly $4$ roots, an even number of complex roots and an even number of real roots.
Other combinations of real and complex roots are possible, but they produce complex coefficients.
Graph of typical quartic function showing minima and maximum.
The figure shows a typical quartic function.
The function crosses the $X$
axis in 4 different places. The function has 4 roots: $(-2,0),(1,0),(5,0),(10,0).$
This function contains one local minimum, one local maximum and one absolute minimum. There is no absolute maximum.
Because the function contains one absolute minimum:
If abs($x$) is very large, $f(x)$ is always positive.
If absolute minimum is above $X$ axis, curve does not cross $X$ axis and function contains only complex roots.
There is always at least one point where the curve is parallel to $X$ axis.
The curve is never parallel to the $Y$ axis. For any real value of $x$ there is always a real value of $y.$
When coefficient d is missing, there is a stationary point at x = 0.
If coefficient $d$ is missing, the quartic function becomes
$y=ax^{4}+bx^{3}+cx^{2}+e,$ and
$y'=4ax^{3}+3bx^{2}+2cx=x(4ax^{2}+3bx+2c).$
For a stationary point $y'=x(4ax^{2}+3bx+2c)=0.$
When coefficient $d$ is missing, there is always a stationary point at $x=0.$
Graph of quartic function that is quadratic in $x^{2}$. Because coefficient $d$ is missing, there is a stationary point where $x=0.$
If coefficients $b,d$ are missing, the quartic function becomes a quadratic in $x^{2}.$
The curve (red line) in diagram has equation: $y=f(x)={\frac {x^{4}-13x^{2}+36}{5}}$
The quartic equation may be solved as: $X^{2}-13X+36=0$ where
$X=x^{2}$ or $x={\sqrt {X}}.$
$X=4$ or $X=9.$
$x=\pm 2$ or $x=\pm 3.$
The quartic function may be expressed as $x=ay^{4}+by^{3}+cy^{2}+dy+e.$
Unless otherwise noted, references to "quartic function" on this page refer to function of form
$y=ax^{4}+bx^{3}+cx^{2}+dx+e.$
Graph of quartic function with coefficient a negative. There is no absolute minimum.
Coefficient $a$ may be negative as shown in diagram.
As abs$(x)$ increases, the value of $f(x)$ is dominated by the term $-ax^{4}.$
When abs$(x)$ is very large, $f(x)$ is always negative.
Unless stated otherwise, any reference to "quartic function" on this page will assume coefficient $a$
positive.
Graph of quartic function with coefficient b missing.
Sum of roots is $0.$
$Y$axis compressed for clarity.
When sum of roots is $0,$ coefficient $b=0.$
In the diagram, roots of $f(x)$ are $-5,-4,2,7.$
Sum of roots $=0.$
Therefore coefficient $b=0.$
Function as product of linear function and cubic
Graphs of quartic function and associated cubic function.
When $p$ is a root of the function, the function may be expressed as:
$(x-p)(Ax^{3}+Bx^{2}+Cx+D)$ where
$A=a;\ B=Ap+b;\ C=Bp+c;\ D=Cp+d.$
When one real root $p$ is known, the other three roots may be calculated as roots
of the cubic function $Ax^{3}+Bx^{2}+Cx+D.$
In the diagram the quartic function has equation: $y={\frac {x^{4}-23x^{3}+163x^{2}-393x+252}{48}}.$
It is known that $3$ is a root of this function.
The associated cubic has equation: $y={\frac {x^{3}-20x^{2}+103x-84}{48}}$
The 2 curves coincide at points $(1,0),\ (7,0),\ (12,0),$ the three points that are roots of both functions.
Function defined by 5 points
Figure 1. Quartic function defined by 5 points Any 5 points on the curve may be used to define the function.
Because the quartic function contains 5 coefficients, 5 simultaneous equations are needed to define the function.
See Figure 1. The quartic function may be defined by any 5 unique points on the curve.
For example, let us choose the five points:
$(-5,0),(-2,0),(1,0),(3,-6),(6,2)$
Rearrange the standard quartic function to prepare for the calculation of
$a,b,c,d,e:$
$x^{4}a+x^{3}b+x^{2}c+xd+1e-y=0.$
For function solveMbyN see
"Solving simultaneous equations" .
# python code
points = (-5,0), (-2,0), (1,0), (3,-6), (6,2)
L11 =
for point in points :
x,y = point
L11 += [[x*x*x*x, x*x*x, x*x, x, 1, -y]]
print (L11)
[[ 625.0, -125.0, 25.0, -5.0, 1.0, 0.0], #
[ 16.0, -8.0, 4.0, -2.0, 1.0, 0.0], #
[ 1.0, 1.0, 1.0, 1.0, 1.0, 0.0], # matrix supplied to function solveMbyN below.
[ 81.0, 27.0, 9.0, 3.0, 1.0, 6.0], # 5 rows by 6 columns.
[1296.0, 216.0, 36.0, 6.0, 1.0, -2.0]] #
# python code
output = solveMbyN(L11)
print (output)
# 5 coefficients a, b, c, d, e:
(0.02651515151515152, 0.004545454545454542, -0.847727272727273, -0.728787878787879, 1.5454545454545459)
Quartic function defined by the 5 points $(-5,0),(-2,0),(1,0),(3,-6),(6,2)$ is
$y={\frac {0.875x^{4}+0.15x^{3}-27.975x^{2}-24.05x+51}{33}}.$
Function defined by 3 points and 2 slopes
Figure 1. Quartic function defined by 3 points and 2 slopes. Any 3 points on the curve and the slopes at any 2 of these points may be used to define the function. Slope at $(-2,-2)\ =$ slope at $(6,-4)\ =\ 0.$
Because the quartic function contains 5 coefficients, 5 simultaneous equations are needed to define the function.
See Figure 1. The quartic function may be defined by any 3 unique points on the curve
and the slopes at any 2 of these points.
For example, let us choose the three points:
$(-2,-2),(6,-4),(4,1)$
At point $(-2,-2)$ slope is $0.$
At point $(6,-4)$ slope is $0.$
Rearrange the standard quartic function to prepare for the calculation of
$a,b,c,d,e:$
$x^{4}a+x^{3}b+x^{2}c+xd+1e-y=0.$
Rearrange the standard cubic function of slope to prepare for the calculation of
$a,b,c,d,e:$
$4x^{3}a+3x^{2}b+2xc+1d+0e-s=0.$
For function solveMbyN see
"Solving simultaneous equations" .
# python code
def makeEntry(input) :
x,y,s = ( tuple(input) + (None,) )[:3]
L1 =
if s != None :
L2 = [ float(v) for v in [4*x*x*x, 3*x*x, 2*x, 1, 0, -s] ]
L1 += [ L2 ]
L2 = [ float(v) for v in [x*x*x*x, x*x*x, x*x, x, 1, -y]]
L1 += [ L2 ]
return L1
t1 = (
(-2,-2, 0), # point (-2, -2) with slope 0.
(6,-4, 0), # point (6, -4) with slope 0.
(4,1), # point (4, 1)
L1 =
for v in t1 : L1 += makeEntry ( v )
print (L1)
[[ -32.0, 12.0, -4.0, 1.0, 0.0, 0.0], #
[ 16.0, -8.0, 4.0, -2.0, 1.0, 2.0], #
[ 864.0, 108.0, 12.0, 1.0, 0.0, 0.0], # matrix supplied to function solveMbyN below.
[1296.0, 216.0, 36.0, 6.0, 1.0, 4.0], # 5 rows by 6 columns.
[ 256.0, 64.0, 16.0, 4.0, 1.0, -1.0]]. #
# python code
output = solveMbyN(L1)
print (output)
# 5 coefficients a, b, c, d, e:
(0.03255208333333339, -0.2526041666666665, -0.3072916666666667, 2.84375, 2.375)
Quartic function defined by three points and two slopes is:
$y={\frac {1.5625x^{4}-12.125x^{3}-14.75x^{2}+136.5x+114.0}{48}}.$
Associated cubic functions
When p == -2
Figure 1. Quartic function and associated cubic function when p = -2. In this case roots of associated cubic include x = p.
Quartic function is: $y=f(x)={\frac {1.5625x^{4}-12.125x^{3}-14.75x^{2}+136.5x+114.0}{48}}.$
When $p==-2,$ associated cubic function is :
$y=g(x)={\frac {1.5625x^{3}-15.25x^{2}+15.75x+105}{48}}.$
Three blue vertical lines show 3 values of $x$ where $g(x)=0$ and
$f(x)=f(-2)$
In this case roots of $g(x)$ include $x=p.$
When p == 5
Figure 1. Quartic function and associated cubic function when p = 5. In this case the one root of associated cubic excludes x = p.
Quartic function is: $y=f(x)={\frac {1.5625x^{4}-12.125x^{3}-14.75x^{2}+136.5x+114.0}{48}}.$
When $p==5,$ associated cubic function is :
$y=g(x)={\frac {1.5625x^{3}-4.3125x^{2}-36.3125x-45.0625}{48}}.$
Two blue vertical lines show 2 values of $x$ where $f(x)=f(5)$
In this case the one root of $g(x)$ excludes $x=p.$
When p == 6
Figure 1. Quartic function and associated cubic function when p = 6. In this case the one root of associated cubic includes x = p.
Quartic function is: $y=f(x)$$={\frac {1.5625x^{4}-12.125x^{3}-14.75x^{2}+136.5x+114.0}{48}}.$
When $p==6,$ associated cubic function is:
$y=g(x)$$={\frac {1.5625x^{3}-2.75x^{2}-31.25x-51}{48}}.$
One blue vertical line shows 1 value of $x$ where $f(x)=f(6)$
In this case the one root of $g(x)$ includes $x=p.$
Examples
Quartic with 2 stationary points
Graph of quartic function with 2 stationary points.
In the diagram the red line represents quartic function $y=f(x)=4(x^{4}+3x^{3}+3x^{2}+x)-1.$
The grey line $g(x)$ is the first derivative of $f(x).$
The 2 roots of $g(x),\ -1$ and ${\frac {-1}{4}}$ show that $f(x)$ has
stationary points at $x=-1$ and $x=-0.25.$
Quartic with 1 stationary point
Graph of quartic function with 1 stationary point.
In the diagram the red line represents quartic function $y=f(x)={\frac {x^{4}+3x^{3}+3x^{2}+3x}{2}}$
The grey line $g(x)$ is the first derivative of $f(x).$
The 1 root of $g(x),\ -1.607$ (approx.), shows that $f(x)$ has
1 stationary point where $g(x)=0.$ :

# First and second derivatives

Points of inflection
Graphs of quartic function and first two derivatives. Dotted portion of black line shows where f(x) is always concave down. Dotted portion of red line shows where g(x) is decreasing. Dotted portion of blue line shows where h(x) is negative. When h(x) is negative, f(x) is concave down. When h(x) is positive, f(x) is concave up.
In the diagram the black line has equation: $y=f(x)={\frac {x^{4}-16x^{3}+42x^{2}+12x+4}{144}}.$
The first derivative, the red line, has equation: $y'=g(x)={\frac {x^{3}-12x^{2}+21x+3}{36}}.$
The second derivative, the blue line, has equation: $y''=h(x)={\frac {x^{2}-8x+7}{12}}.$
When $x<x_{1}:$
$y'$ is increasing.
$y''$ is positive.
$f(x)$ is always concave up.
When $x==x_{1}:$
$y'$ is at a local maximum.
$y''=0.$
Concavity of $f(x)$ is between up and down.
When $x_{1}<x<x_{2}:$
$y'$ is decreasing.
$y''$ is negative.
$f(x)$ is always concave down.
When $x==x_{2}:$
$y'$ is at a local minimum.
$y''=0.$
Concavity of $f(x)$ is between down and up.
When $x_{2}<x:$
$y'$ is increasing.
$y''$ is positive.
$f(x)$ is always concave up.
The roots of $h(x):x_{1}=1,x_{2}=7.$
Let point $p_{1}$ on $f(x)$ have coordinates $(x_{1},f(x_{1})).$
Let point $p_{2}$ on $f(x)$ have coordinates $(x_{2},f(x_{2})).$
At point $p_{1}$ concavity of $f(x)$ changes from up to down.
At point $p_{2}$ concavity of $f(x)$ changes from down to up.
The points $p_{1},p_{2}$ (the $X$ coordinates of which are roots of $h(x)$) are the points of inflection of $f(x).$
Maxima and minima
Graphs of quartic function and first two derivatives showing maximum and minima.
Point $p_{2}$ on $f(x)$ is a stationary point.
$f(x)$ at point $p_{2}$ is concave down.
Point $p_{2}$ is local maximum.
Point $p_{1}$ on $f(x)$ is a stationary point.
$f(x)$ at point $p_{1}$ is concave up.
Point $p_{1}$ is local minimum.
Similarly, point $p_{3}$ is local minimum.
In the diagram the black line has equation:
$y=f(x)={\frac {1.5625x^{4}-12.125x^{3}-14.75x^{2}+136.5x+114}{48}}.$
The first derivative, the red line, has equation: $y'=g(x)={\frac {6.25x^{3}-36.375x^{2}-29.5x+136.5}{48}}.$
The second derivative, the blue line, has equation: $y''=h(x)={\frac {18.75x^{2}-72.75x-29.5}{48}}.$
Roots of $g(x):\ x_{1}=-2;\ x_{2}=1.82;\ x_{3}=6.$
Let point $p_{1}$ on $f(x)$ have coordinates $(x_{1},f(x_{1})).$
At $x_{1}\ h(x_{1})$ is positive. Point $p_{1}$ is a stationary point and
$f(x)$ at $p_{1}$ is concave up. Point $p_{1}$ is a local minimum.
Let point $p_{2}$ on $f(x)$ have coordinates $(x_{2},f(x_{2})).$
At $x_{2}\ h(x_{2})$ is negative. Point $p_{2}$ is a stationary point and
$f(x)$ at $p_{2}$ is concave down. Point $p_{2}$ is a local maximum.
Let point $p_{3}$ on $f(x)$ have coordinates $(x_{3},f(x_{3})).$
At $x_{3}\ h(x_{3})$ is positive. Point $p_{3}$ is a stationary point and
$f(x)$ at $p_{3}$ is concave up. Point $p_{3}$ is a local minimum.
Quartic with 2 stationary points
Graph of quartic function with 2 stationary points and first 2 derivatives.
Black line: $y=f(x)=4(x^{4}+3x^{3}+3x^{2}+x)-1.$
Red line: $y'=g(x)=4(4x^{3}+9x^{2}+6x+1).$
$y''=h(x)=4(12x^{2}+18x+6)$
Blue line: $y''=4(2x^{2}+3x+1)={\frac {h(x)}{6}}.$
Dotted portion of black line shows where $f(x)$ is concave down.
In the diagram, point $p_{1}$ on $f(x)$ has coordinates $(x_{1},f(x_{1})).$
Similarly, points $p_{2},p_{3}$ have coordinates $(x_{2},f(x_{2})),\ (x_{3},f(x_{3})).$
$y'$ has roots: $x_{1}=-1;\ x_{3}=-0.25.$
Points $p_{1},p_{3}$ are stationary points.
$y''$ has roots: $x_{1}=-1;\ x_{2}=-0.5.$
Points $p_{1},p_{2}$ are points of inflection.
At point $p_{3}\ y''$ is positive. $f(x)$ at $p_{3}$ is concave up.
Point $p_{3}$ is local minimum.
Summary:
Point $p_{1}$ is both stationary point and point of inflection.
Point $p_{2}$ is point of inflection.
Point $p_{3}$ is both stationary point and local minimum. :

# The simplest quartic function

* Graph of simplest quartic function.
* Point $p_{1}\ (-1.1,0)$ is a root of $f(x).$
* Point $p_{2}\ (1.1,0)$ is a root of $f(x).$
* Point $p_{0}\ (0,-1.1^{4})$ is $Y$ intercept of $f(x).$
* The simplest quartic function has coefficients $b=c=d=0.$
* Red line in diagram has equation: $y=f(x)=x^{4}-1.1^{4}$
* First derivative (not shown) of $f(x):\ y'=g(x)=4x^{3}.$
* When $x==0,\ g(x)=0.$ There is a stationary point on $f(x)$ when $x==0,$
* point $p_{0}.$
* Second derivative (not shown) of $f(x):\ y''=h(x)=12x^{2}.$
* When $x==0,\ h(x)=0.$ There is a point of inflection on $f(x)$ when $x==0.$
* For every non-zero value of $x,\ h(x)$ is positive. To left and right of point $p_{0},\ f(x)$
* is always concave up. Point $p_{0}$ is both local minimum and absolute minimum.
* Point $p_{0}$ is stationary point and point of inflection and absolute minimum.
* Curve $f(x)$ is useful for finding the fourth root of a real number.
* Solve: $x=N^{\frac {1}{4}}.$
* $x^{4}=N.$
* $x^{4}-N=0.$
* This is equivalent to finding a root of function $y=j(x)=x^{4}-N.$
* If you use Newton's method to find a root of $j(x),$ this would be more efficient than solving
* $x={\sqrt {\sqrt {N}}}.$

# Roots of equal absolute value

* Graph of quartic function with 2 roots of equal absolute value.
* In the diagram the red line has equation: $y=f(x)={\frac {x^{4}-12x^{3}+31x^{2}+48x-140}{45}}.$
* $a,b,c,d,e=1,-12,31,48,-140$
* $c_{0}=add+bbe-bcd$$=1(48)(48)+(-12)(-12)(-140)-(-12)(31)(48)=0.$
* $f(x)$ has roots of equal absolute value.
* $q={\sqrt {\frac {-d}{b}}}={\sqrt {\frac {-48}{-12}}}={\sqrt {4}}=\pm 2.$
* The 2 roots of equal absolute value are: $2,-2.$
* Graph of quartic function with 2 complex roots of equal absolute value.
* In the diagram the red line has equation: $y=f(x)={\frac {x^{4}-3x^{3}-x^{2}-27x-90}{50}}.$
* $a,b,c,d,e=1,-3,-1,-27,-90$
* $c_{0}=0.$
* $f(x)$ has roots of equal absolute value.
* $q={\sqrt {\frac {-d}{b}}}={\sqrt {\frac {-(-27)}{-3}}}={\sqrt {-9}}=\pm 3i.$
* The 2 roots of equal absolute value are: $3i,-3i.$

# Equal roots

* If coefficient $d$ is non-zero, it is not necessary to calculate $status.$
* If coefficient $d==0,$ verify that $status=0$ before proceeding.

# Depressed quartic

A depressed quartic is any quartic function with any one or more of coefficients $b,c,d$
missing. Within this section a depressed quartic has coefficient $b$ missing.
To produce the depressed quartic:
$y=ax^{4}+bx^{3}+cx^{2}+dx+e\ \dots \ (1)$
$y={\frac {(4^{4}a^{3})(ax^{4}+bx^{3}+cx^{2}+dx+e)}{4^{4}a^{3}}}\ \dots \ (2)$
Let $x={\frac {-b+t}{4a}}.$ Substitute in $(2),$ expand and simplify:
$y={\frac {t^{4}+At^{2}+Bt+C}{4^{4}a^{3}}}\ \dots \ (3)$
where:
$A=16ac-6b^{2}$
$B=64a^{2}d-32abc+8b^{3}$
$C=256a^{3}e-64a^{2}bd+16ab^{2}c-3b^{4}$
When equated to $0,\ (3)$ becomes the depressed equation:
$t^{4}+At^{2}+Bt+C=0\ \dots \ (4).$
Be prepared for the possibility that any 1 or more of $A,B,C$ may be zero.
Coefficient B missing
Graph of quartic function that resembles a quadratic.
If coefficient $B==0,\ (4)$ becomes a quadratic in $t^{2}:$
$t^{4}+At^{2}+C=0.$
$(1)$ has the appearance of a quadratic.
The black line: $y=f(x)={\frac {x^{4}-4x^{3}+9x^{2}-10x+5}{10}}$
$B=64a^{2}d-32abc+8b^{3}$
$=8(8(-10)-4(-4)(9)+-64)$
$=8(-80+144-64)$
$=8(0)=0.$
The red line: $y'=g(x)={\frac {4x^{3}-12x^{2}+18x-10}{10}}$
$y'=g(x)=0$ where $x=1.$
The grey line: $y''=h(x)={\frac {12x^{2}-24x+18}{10}}$
Absolute minima of $f(x)$ and of $h(x)$ and point of inflection of $g(x)$ occur where $x={\frac {-b}{4}}=1.$
$y''$ is always positive. $f(x)$ is always concave up.
$f(1+p)=f(1-p).$
If $(1)$ contains 2 pairs of equal roots, coefficient $B=0.$
The converse is not necessarily true.
If $(1)$ contains 4 equal roots, coefficients $A=B=C=0.$
Coefficient C missing
Graph of quartic function with coefficient C of depressed function missing.
$Y$ axis compressed for clarity.
If coefficient $C==0,\ (4)$ becomes:
$t^{4}+At^{2}+Bt=t(t^{3}+At+B)=0$
in which case $t=0$ is a solution and $x={\frac {-b}{4a}}$ is a root of $(1).$
Curve (red line) in example has equation: $y=f(x)=8x^{4}+16x^{3}+24x^{2}+89x+40.$
Coefficients of depressed function are:
# python code
a,b,c,d,e = 8, 16, 24, 89, 40
A = 16*a*c - 6*b*b
B = 64*a*a*d - 32*a*b*c + 8*b*b*b
C = 256*a*a*a*e - 64*a*a*b*d + 16*a*b*b*c - 3*b*b*b*b
A,B,C
(1536, 299008, 0)
Coefficient $C$ of depressed function is missing. $t=0$ is a solution.
Using $x={\frac {-b+t}{4a}},$
one root of $f(x)={\frac {-16+0}{4(8)}}=-0.5.$
Resolvent cubic
This section introduces a special cubic function called "resolvent" because it helps to resolve a requirement, the calculation of the roots of the quartic.
The depressed quartic: $t^{4}+At^{2}+Bt+C\ \dots \ (1)$
For $t$ substitute $(u+v)\ \dots \ (2)$
For $t$ substitute $(u-v)\ \dots \ (3)$
$(2)+(3):\ 2Auu+2Avv+2Bu+2C+2uuuu+12uuvv+2vvvv\ \dots \ (4)$
Simplify $(4):\ Auu+AV+Bu+C+uuuu+6uuV+VV\ \dots \ (4a)$
$(2)-(3):\ 4Auv+2Bv+8uuuv+8uvvv\ \dots \ (5)$
Simplify $(5):\ 2Au+B+4uuu+4uV\ \dots \ (5a)$
From $(5a):\ 4uV=-(2Au+B+4uuu)\ \dots \ (5b)$
$(4a)*4u4u:\ 4u4uAuu+A4u(4uV)+4u4uBu+4u4uC+4u4uuuuu+6uu4u(4uV)+(4uV)(4uV)\ \dots \ (6)$
In $(6)$ replace $4uV$ with $(-(2Au+B+4uuu)),$ expand, simplify,
gather like terms and result is:
$Pu^{6}+Qu^{4}+Ru^{2}+S$ or
$PU^{3}+QU^{2}+RU+S\ \dots \ (7)$ where:
$U=u^{2}$
$P=64$
$Q=32A$
$R=4A^{2}-16C$
$S=-B^{2}$
From $(5b):\ V=v^{2}={\frac {-(2Au+B+4uuu)}{4u}}=-({\frac {A}{2}}+U)-{\frac {B}{4u}}\ \dots \ (8)$
Some simple changes reduce the number of calculations and also the sizes of coefficients $P,Q,R,S.$
$A2=8ac-3b^{2}$ where $A2={\frac {A}{2}}$
$B4=16a^{2}d-8abc+2b^{3}$ where $B4={\frac {B}{4}}$
$C=256a^{3}e-64a^{2}bd+16ab^{2}c-3b^{4}$
Then:
$P=64$
$Q=32(A2)(2)=64A2$
$R=4(A2)(2)(A2)(2)-16C=16A2^{2}-16C$
$S=-(B4)(4)(B4)(4)=-16B4^{2}$
Divide all 4 coefficients by $16:$
$P=4$
$Q=4A2$
$R=A2^{2}-C$
$S=-B4^{2}$
$V=v^{2}=-(A2+U)-{\frac {B4}{u}}.$
A close examination of coefficients $R,S$ shows that both coefficients are always
exactly divisible by $4.$
Therefore, all four coefficients may be defined as follows:
$P=1$
$Q=A2$
$R={\frac {A2^{2}-C}{4}}$
$S={\frac {-B4^{2}}{4}}$ :

# Solving quartic equation

This section presents 4 examples that show how to use the depressed quartic and the resolvent cubic to solve the quartic equation.

## Four real roots

* Graphs of quartic function with 4 real roots and associated resolvent cubic.
* Resolvent cubic contains 3 real, positive roots.
* Calculate roots of: $y=f(x)=x^{4}-x^{3}-19x^{2}-11x+30$
Calculate coefficients of depressed quartic:
* a,b,c,d,e = 1,-1,-19,-11,30
* A = 16*a*c - 6*b*b
* B = 64*a*a*d - 32*a*b*c + 8*b*b*b
* C = 256*a*a*a*e - 64*a*a*b*d + 16*a*b*b*c - 3*b*b*b*b
* print (A,B,C)
* -310 -1320 6669
Calculate coefficients of resolvent cubic:
* P = 64
* Q = 32*A
* R = 4*A*A - 16*C
* S = -B*B
* print (P,Q,R,S)
* 64 -9920 277696 -1742400
Calculate roots of cubic function: $y=g(x)=64x^{3}-9920x^{2}+277696x-1742400.$
There are 3 real, positive roots: $9,25,121.$
Using 3 roots of $g(x),$ calculate 4 roots of $f(x):$
* # python code
* for U in (9, 25, 121) :
* print ('\nU =', U)
* sqrtU = U ** 0.5
* for u in (sqrtU, -sqrtU) :
* V = -(A/2 + U) - B/(4*u)
* v = V ** .5
* for t in (u+v, u-v) :
* x = (-b+t) / (4*a)
* y = a*x**4 + b*x**3 + c*x**2 + d*x + e
* print ('x:',x, '; y:',y)
* U = 9
* x: 5.0 ; y: 0.0
* x: -3.0 ; y: 0.0
* x: 1.0 ; y: 0.0
* x: -2.0 ; y: 0.0
* U = 25
* x: 5.0 ; y: 0.0
* x: -2.0 ; y: 0.0
* x: 1.0 ; y: 0.0
* x: -3.0 ; y: 0.0
* U = 121
* x: 5.0 ; y: 0.0
* x: 1.0 ; y: 0.0
* x: -2.0 ; y: 0.0
* x: -3.0 ; y: 0.0
* Roots of $f(x)$ are: $5,1,-2,-3.$
All 3 values of $U$ produce the same results, but not in same sequence.
It is not necessary to calculate all 3 roots of resolvent cubic. Any one non-zero root is sufficient to do the job.

## Two real and two complex roots
### Example 1

* Graphs of quartic function with 2 real and 2 complex roots and associated resolvent cubic.
* Calculate roots of: $y=f(x)=x^{4}+2x^{3}+18x^{2}-70x-87$
* a,b,c,d,e = 1,2,18,-70,-87
* A = 16*a*c - 6*b*b
* B = 64*a*a*d - 32*a*b*c + 8*b*b*b
* C = 256*a*a*a*e - 64*a*a*b*d + 16*a*b*b*c - 3*b*b*b*b
* print (A,B,C)
* 264 -5568 -12208
* P = 64
* Q = 32*A
* R = 4*A*A - 16*C
* S = -B*B
* print (P,Q,R,S)
* 64 8448 474112 -31002624
* # python code
* U = 36
* u1 = U**.5
* for u in (u1, -u1) :
* V = -(A/2 + U) - B/(4*u)
* if V >= 0 : v = V**.5
* else : v = 1j * (-V)**.5
* for t in (u+v, u-v) :
* x = (-b+t)/(4*a)
* # Check result. Expecting sum = 0.
* sum = a*x**4 + b*x**3 + c*x**2 + d*x + e
* print ('x =',x, '; sum =',sum )
* x = 3.0 ; sum = 0.0
* x = -1.0 ; sum = 0.0
* x = (-2+5j) ; sum = 0j
* x = (-2-5j) ; sum = 0j

### Example 2

* Coefficient $d$ of $g(x)=0.$ $$
* Calculate roots of: $y=f(x)$ $=3x^{4}-6x^{3}-41x^{2}+44x-189$
Calculate coefficients of depressed quartic:
* a,b,c,d,e = 3, -6, -41, 44, -189
* A = 16*a*c - 6*b*b
* B = 64*a*a*d - 32*a*b*c + 8*b*b*b
* C = 256*a*a*a*e - 64*a*a*b*d + 16*a*b*b*c - 3*b*b*b*b
* print (A,B,C)
* -2184, 0, -1229040
* Notice that coefficient $B=0.$
Calculate coefficients of resolvent cubic:
* P = 64
* Q = 32*A
* R = 4*A*A - 16*C
* S = -B*B
* print (P,Q,R,S)
* 1, -1092, 605376, 0
* Notice that coefficient $S=0.$
Calculate roots of cubic function: $y=g(x)=x^{3}-1092x^{2}+605376x+0.$
Roots are $0,546\pm 554.3103823671355j.$
Value $0$ cannot be used because it will cause error Divide by zero at statement V = -(A/2 + U) - B/(4*u).
Calculate roots of $f(x):$
* # python code
* U = 546+554.3103823671355j
* print ('\nU =',U)
* sqrtU = U ** 0.5
* for u in (sqrtU, -sqrtU) :
* V = -(A/2 + U) - B/(4*u)
* v = V ** 0.5
* s1 = '\nu,v'
* print (s1,eval(s1))
* for t in (u+v, u-v) :
* x = (-b+t)/(4*a)
* # Check result. Expecting sum = 0.
* sum = a*x**4 + b*x**3 + c*x**2 + d*x + e
* print ('x =', x,'; sum =',sum)
* U = (546+554.3103823671355j)
* u,v ((25.729935131257832+10.771701901683684j), (25.729935131257832-10.771701901683684j))
* x = (4.788322521876306 + 0j) ; sum = (1.9895196601282805e-13 + 0j)
* x = (0.5 + 1.795283650280614j) ; sum = (5.684341886080802e-14 + 0j)
* u,v ((-25.729935131257832-10.771701901683684j), (25.729935131257832-10.771701901683684j))
* x = (0.5 - 1.795283650280614j) ; sum = (5.684341886080802e-14 + 0j)
* x = (-3.7883225218763052 + 0j) ; sum = (1.7053025658242404e-13 + 0j)
* Values of $x$ are: $-3.7883225218763052,4.788322521876306,0.5\pm 1.795283650280614j$

#### Depressed quartic as quadratic

In this example coefficient $B$ of depressed quartic $=0.$
Therefore, resolvent cubic can be ignored and depressed quartic processed as quadratic in $T=t^{2}.$
$t^{4}-2184t^{2}+(0)t-1229040$
$T^{2}-2184T-1229040$ where $T=t^{2}.$
Solutions of this quadratic are: $T_{1},T_{2}=2648.1182474349434,-464.11824743494344$
or
With precision of 15, values of $x$ are same as those shown above.
When roots of quartic function are of form p ± q, p ± r, coefficient $B$ of depressed function $=0.$

## Four complex roots

* Graphs of quartic function with 4 complex roots and associated resolvent cubic.
* Calculate roots of: $y=f(x)=x^{4}-20x^{3}+408x^{2}+2296x+18020$
Calculate coefficients of depressed quartic:
* 4128 344064 9683200
Calculate coefficients of resolvent cubic:
* 64 132096 -86769664 -118380036096
Calculate one root of cubic function: $y=g(x)=64x^{3}+132096x^{2}-86769664x-118380036096.$
There are 3 real roots: $-2304,-784,1024.$ Choose $U=-784.$
Negative $U$ is chosen here to show that any 1 of the roots produces the correct result.
Calculate roots of $f(x):$
* # python code
* U = -784
* u1 = 1j * (-U)**.5
* for u in (u1, -u1) :
* V = -(A/2 + U) - B/(4*u)
* v = V**.5
* for t in (u+v, u-v) :
* x = (-b+t)/(4*a)
* # Check result. Expecting sum = 0.
* sum = a*x**4 + b*x**3 + c*x**2 + d*x + e
* print ('x =', x,'; sum =',sum)
* # python expresses complex numbers with 'j'.
* x = (13+19j) ; sum = 0j
* x = (-3-5j) ; sum = 0j
* x = (13-19j) ; sum = 0j
* x = (-3+5j) ; sum = 0j

# Quartic formula

The substitutions made above can be used to produce a formula for the solution of the quartic equation.
See main articles "The general case" or "General formula for roots."
* Both links above point to formula for equation $x^{4}+ax^{3}+bx^{2}+cx+d=0.$
Given quartic equation:
$ax^{4}+bx^{3}+cx^{2}+dx+e=0,$ calculate the 4 values of $x.$
$x={\frac {-b+t}{4a}}$ where:
* Coefficients of depressed quartic:
* $A=16ac-6b^{2}$
* $B=64a^{2}d-32abc+8b^{3}$
* $C=256a^{3}e-64a^{2}bd+16ab^{2}c-3b^{4}$
* Coefficients of resolvent cubic:
* $a_{1}=P=64$
* $b_{1}=Q=32A$
* $c_{1}=R=4A^{2}-16C$
* $d_{1}=S=-B^{2}$
* Coefficients of depressed cubic:
* $A_{1}=9a_{1}c_{1}-3b_{1}^{2}$
* $B_{1}=27a_{1}^{2}d_{1}-9a_{1}b_{1}c_{1}+2b_{1}^{3}$
* One root of resolvent cubic:
* $C_{1}={\frac {-A_{1}}{3}}=b_{1}^{2}-3a_{1}c_{1}$
* $\Delta =B_{1}^{2}-4C_{1}^{3}\ \dots \dots \ \Delta$ may be negative.
* $\delta ={\sqrt {\Delta }}$
* $W={\frac {-B_{1}+\delta }{2}}$
* $w={\sqrt[{3}]{W}}$
* $t_{1}=w+{\frac {C_{1}}{w}}$
* $U={\frac {-b_{1}+t_{1}}{3a_{1}}}$
* One root of quartic:
* $u={\sqrt {U}}\ \dots \dots \ u$ may be positive or negative.
* $V=-({\frac {A}{2}}+U)-{\frac {B}{4u}}$
* $v={\sqrt {V}}\ \dots \dots \ v$ may be positive or negative.
* $t=u+v$
Formula above produces one value of $x.$ Python code below utilizes $\pm {\sqrt {U}}$ and $\pm {\sqrt {V}}$ to produce 4 values of $t$ and then, four values of $x.$

## An example:

* values_of_t = [116, -44, (-36+64j), (-36-64j)]
* Because $f(t)$ is a depressed quartic function, sum of four values_of_t $=116-44-36(2)=0.$
* Values displayed above have been edited slightly. Actual calculated values were:
* values_of_x = [7.000000000000001,
* -3.0000000000000044,
* (-2.499999999999998+4.000000000000001j),
* (-2.4999999999999987-4.000000000000001j)]

## In practice

* # python code
* import cmath
* cxSqrt = cmath.sqrt # Square root of complex number.
* def rootsOfQuartic (abcde) :
* x1,x2,x3,x4 = rootsOfQuartic ((a,b,c,d,e))
* Each member of input must be int or float or Decimal object.
* Int or Decimal object in input is quietly converted to float.
* Output may be None.
* def formatResults (x1x2x3x4) :
* This function improves appearance of results.
* (8 + 0j) becomes 8.0
* values_of_x = list (x1x2x3x4)
* for p in (0,1,2,3) :
* v = values_of_x[p]
* if isinstance (v, complex) and (v.imag == 0) : values_of_x[p] = v.real
* return values_of_x
* status = 0
* try : a,b,c,d,e = [ float(v) for v in abcde ]
* except : status = 1
* if status :
* print ('rootsOfQuartic 1: Error creating coefficients a,b,c,d,e.')
* return None
* if a == 0 :
* print ('rootsOfQuartic 2: Coefficient a must be non-zero.')
* return None
* # Coefficients of depressed quartic, modified.
* # A = 16*a*c - 6*b*b
* A2 = 8*a*c - 3*b*b
* # B = 64*a*a*d - 32*a*b*c + 8*b*b*b
* B4 = 16*a*a*d - 8*a*b*c + 2*b*b*b
* C = 256*a*a*a*e - 64*a*a*b*d + 16*a*b*b*c - 3*b*b*b*b
* if B4 == 0 :
* # B = 0.
* # Result returned from this section is type tuple, indicating that coefficient B4 = 0.
* if A2==C==0 :
* # 4 equal roots.
* root = -b/(4*a)
* return tuple(formatResults((root,root,root,root)))
* # t**4 + At**2 + (0)t + C
* # Depressed quartic is quadratic in T:
* # T**2 + AT + C where T = t**2
* # T**2 + 2(A2)T + C where A = 2(A2)
* # -2(A2) +/- (4(A2)(A2) - 4C)**0.5
* # T = -------------------------------- = -A2 +/- ((A2)(A2) - C)**0.5
* # 2
* disc = A2*A2 - C
* if disc >= 0 : root = disc ** 0.5
* else : root = ((-disc) ** 0.5) * 1j
* T1 = -A2 - root ; T2 = -A2 + root
* t1 = cxSqrt(T1) ; t2 = cxSqrt(T2)
* values_of_t = (t1,-t1,t2,-t2)
* values_of_x = [ (-b + t)/(4*a) for t in values_of_t ]
* return tuple(formatResults(values_of_x))
* # B4 is non-zero. Therefore, all of (S, U, u) are non-zero.
* P,Q,R,S = 1, A2, (A2*A2 - C)/4, -B4*B4/4
* # str1 = 'P,Q,R,S' ; print (str1, eval(str1))
* U = oneRootOfCubic((P,Q,R,S)) # Resolvent cubic.
* if U > 0 : sqrtU = U ** 0.5
* elif U == 0 :
* # This should not happen.
* print ('rootsOfQuartic 3: Internal error.')
* return None
* else : sqrtU = ((-U) ** 0.5) * 1j
* v1 = -(A2+U)
* values_of_t = [
* t
* for u in (sqrtU, -sqrtU)
* for V in ( v1 - B4/u, )
* for v in ( cxSqrt(V), )
* for t in (u+v, u-v)
* values_of_x = [
* (-b + t)/(4*a)
* for t in values_of_t
* # Result returned from this section is type list, indicating that coefficient B4 != 0.
* return formatResults(values_of_x)
* For function oneRootOfCubic see Cubic_function: In_practice.

# Two Conic Sections

Examples of conic sections include: ellipse, circle, parabola and hyperbola.
This section presents examples of two conic sections, circle and ellipse, and how to calculate the coordinates of the point/s of intersection, if any, of the two sections.
Let one section with name $ABCDEF$ have equation $Ax^{2}+By^{2}+Cxy+Dx+Ey+F=0.$
Let other section with name $abcdef$ have equation $ax^{2}+by^{2}+cxy+dx+ey+f=0.$
Because there can be as many as 4 points of intersection, a special "resolvent" quartic function is used to calculate the $x$ coordinates of the point/s of intersection.
Coefficients of associated "resolvent" quartic are calculated as follows:

## With no common point

* Two conic sections with no common point.
* Resolvent quartic function (black curve) has no real roots.
* $y$ axis of quartic function is compressed to illustrate shape of curve.
* Let ellipse (red curve) have equation:$1.89x^{2}+1.61y^{2}+0.96xy-36.3x-11.6y+130.25=0.$
* Let circle (blue curve) have equation:$x^{2}+y^{2}-6.8x-17.6y+80=0.$
* Then, resolvent quartic function (black curve) has equation:
* $y=f(x)=-x^{4}-16.4x^{3}-432.98x^{2}+6850.532x-22836.7009.$
* $f(x)$ has no real roots. Therefore, there is no point of intersection.

## With one common point

* Two conic sections with one common point.
* Resolvent quartic function (black curve) has two equal, real roots.
* $y$ axis of quartic function is compressed to illustrate shape of curve.
* Let ellipse (red curve) have equation:$1.89x^{2}+1.61y^{2}+0.96xy-36.3x-11.6y+130.25=0.$
* Let circle (blue curve) have equation:$x^{2}+y^{2}-6.8x-17.6y+73=0.$
* Then, resolvent quartic function (black curve) has equation:
* $y=f(x)=-x^{4}-16.4x^{3}-432.84x^{2}+7456.48x-24355.36.$
* Roots of $f(x)$ are:
* $(-14-22.978250586152114j),(-14+22.978250586152114j),5.8,5.8.$
* $f(x)$ has 2 equal, real roots at $x=5.8,$ effectively 1 real root where $x=5.8$
* Therefore, there is one point of intersection where $x=5.8.$

## With two common points
### Example 1

* Two conic sections with two common points.
* Resolvent quartic function (black curve) has two unique, real roots.
* $y$ axis of quartic function is compressed to illustrate shape of curve.
* Let ellipse (red curve) have equation:$1.89x^{2}+1.61y^{2}+0.96xy-36.3x-11.6y+130.25=0.$
* Let circle (blue curve) have equation:$x^{2}+y^{2}-6.8x-17.6y+64=0.$
* Then, resolvent quartic function (black curve) has equation:
* $y=f(x)=-x^{4}-16.4x^{3}-432.66x^{2}+8235.556x-26681.1841.$
* Roots of $f(x)$ are:
* $(-14.361578825892241-23.341853011785357j),$
* $(-14.361578825892241+23.341853011785357j),$
* $4.59885619413921,7.72430145764527.$
* $f(x)$ has 2 unique, real roots at $x=4.59885619413921,7.72430145764527.$
* Therefore, there are two points of intersections where $x=4.59885619413921,7.72430145764527.$

### Example 2

* Two conic sections with two common points.
* Resolvent quartic function (black curve) has two pairs of equal roots.
* $y$ axis of quartic function is compressed to illustrate shape of curve.
* Let ellipse (red curve) have equation:$1.89x^{2}+1.61y^{2}+0.96xy-36.3x-11.6y+130.25=0.$
* Let circle (blue curve) have equation:$x^{2}+y^{2}-18.8x-1.6y+53=0.$
* Then, resolvent quartic function (black curve) has equation:
* $y=f(x)=-x^{4}+37.6x^{3}-504.24x^{2}+2835.04x-5685.16.$
* Roots of $f(x)$ are:$5.8,5.8,13,13.$
* $f(x)$ has 2 pairs of equal roots at $x=5.8,13,$ effectively 2 real roots.
* Therefore, there are two points of intersection where $x=5.8,13.$

## With 3 common points

* Two conic sections with three common points.
* Resolvent quartic function (black curve) has one pair of equal roots and 2 unique, real roots.
* Let ellipse (red curve) have equation:$1.89x^{2}+1.61y^{2}+0.96xy-36.3x-11.6y+130.25=0.$
* Let circle (blue curve) have equation:$x^{2}+y^{2}-17.6x-3.2y+55=0.$
* Then, resolvent quartic function (black curve) has equation:
* $y=f(x)=x^{4}-32.2x^{3}+366.69x^{2}-1784.428x+3165.1876.$
* Roots of $f(x)$ are:$5.8,5.8,6.83589838486224,13.7641016151377.$
* $f(x)$ has 1 pair of equal roots at $x=5.8$
* and 2 unique, real roots at $x=6.83589838486224,13.7641016151377,$
* effectively 3 real roots.
* Therefore, there are three points of intersection where $x=5.8,6.83589838486224,13.7641016151377.$

## With 4 common points

* Two conic sections with four common points.
* Resolvent quartic function (black curve) has 4 unique, real roots.
* $y$ axis of quartic function is compressed to illustrate shape of curve.
* Let ellipse (red curve) have equation:$1.89x^{2}+1.61y^{2}+0.96xy-36.3x-11.6y+130.25=0.$
* Let circle (blue curve) have equation:$x^{2}+y^{2}-18.8x-1.6y+62.99=0.$
* Then, resolvent quartic function (black curve) has equation:
* $y=f(x)=-x^{4}+37.6x^{3}-504.4398x^{2}+2838.79624x-5544.61147921.$
* Roots of $f(x)$ are:$4.36661032156283,8.77936456353008,10.0206354364699,14.4333896784371.$
* $f(x)$ has 4 real roots as shown above.
* Therefore, there are four points of intersection where $x=4.36661032156283,8.77936456353008,10.0206354364699,14.4333896784371.$

# Links to related topics

* "Cubic formula"
* "Complex square root"