# Cubic function

It is not the purpose of this page to repeat good information available elsewhere. However, it seems to the author that other descriptions of the cubic function are more complicated than they need to be. This page attempts to demystify elementary but essential information concerning the cubic function.

# Objective

 Present cubic function and cubic 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 cubic. Simplify Vieta's substitution. Review complex numbers as they apply to a complex cube root. Show that the cubic equation is effectively solved when at least one real root is known. Use Newton's Method to calculate one real root. Show that the cubic equation can be solved with high-school math.

# Lesson

## Introduction

The cubic function is the sum of powers of ${\displaystyle x}$ from ${\displaystyle 0}$ through ${\displaystyle 3}$:

${\displaystyle y=f(x)=ax^{3}+bx^{2}+cx^{1}+dx^{0}}$

usually written as:

${\displaystyle y=f(x)=ax^{3}+bx^{2}+cx+d.}$

If ${\displaystyle d==0}$ the function becomes ${\displaystyle x(ax^{2}+bx+c).}$

• both coefficients ${\displaystyle a,d}$ must be non-zero,
• coefficient ${\displaystyle a}$ must be positive (simply for our convenience),
• all coefficients must be real numbers, accepting that the function may contain complex roots.

The cubic equation is the cubic function equated to zero:

${\displaystyle ax^{3}+bx^{2}+cx+d=0}$.

Roots of the function are values of ${\displaystyle x}$ that satisfy the cubic equation.

### Function as product of 3 linear functions

The function may be expressed as:

${\displaystyle y=(x-p)(x-q)(x-r)}$ where ${\displaystyle p,q,r}$ are roots of the function, in which case

${\displaystyle y=x^{3}-(p+q+r)x^{2}+(pq+qr+rp)x-pqr}$ where: ${\displaystyle a=1;\ b=-(p+q+r);\ c=pq+qr+rp;\ d=-pqr}$

Solving the cubic equation means that, given ${\displaystyle a,b,c,d}$, at least one of ${\displaystyle p,q,r}$ must be calculated.

Given ${\displaystyle b,c,d}$, I found that ${\displaystyle r}$ can be calculated as:

${\displaystyle r^{8}+2br^{7}+(bb+3c)r^{6}+(4bc+2d)r^{5}+(bbc+2bd+3cc)r^{4}+(2bcc+4cd)r^{3}+(2bcd+c^{3}+dd)r^{2}+2ccdr+cdd=0}$

### Function as product of linear function and quadratic

When ${\displaystyle p}$ is a root of the function, the function may be expressed as:

${\displaystyle (x-p)(Ax^{2}+Bx+C)}$ where

${\displaystyle A=a;\ B=Ap+b;\ C=Bp+c.}$

When one real root ${\displaystyle p}$ is known, the other two roots may be calculated as roots of the quadratic function ${\displaystyle Ax^{2}+Bx+C}$.

# The simplest cubic function

 Figure 1. The simplest cubic function has coefficients ${\displaystyle b=c=0.}$ The simplest cubic function has coefficients ${\displaystyle b=c=0}$, for example: ${\displaystyle y=2x^{3}+54}$. To solve the equation: ${\displaystyle 2x^{3}=-54}$ ${\displaystyle x^{3}={\frac {-54}{2}}=-27}$ ${\displaystyle x={\sqrt[{3}]{-27}}=-3}$ The function also contains two complex roots that may be found as solutions of the associated quadratic: ${\displaystyle ax^{2}+(ap+b)x+ap^{2}+bp+c=2x^{2}+(-6)x+(18)}$${\displaystyle =x^{2}-3x+9=0}$ ${\displaystyle x={\frac {3\pm {\sqrt {9-36}}}{2}}}$${\displaystyle ={\frac {3\pm {\sqrt {-27}}}{2}}}$ ${\displaystyle ={\frac {3\pm {\sqrt {27}}{\sqrt {-1}}}{2}}}$${\displaystyle ={\frac {3\pm (3{\sqrt {3}}){\sqrt {-1}}}{2}}}$

# Roots of equal absolute value

The cubic function ${\displaystyle ax^{3}+bx^{2}+cx+d\ \dots \ (1)}$

Let one value of ${\displaystyle x}$ be ${\displaystyle p+q}$ and another be ${\displaystyle p-q}$.

Substitute these values into the original function in ${\displaystyle x\ (1)}$ and expand.

${\displaystyle +appp+3appq+3apqq+aqqq+bpp+2bpq+bqq+cp+cq+d\ \dots \ (2a)}$

${\displaystyle +appp-3appq+3apqq-aqqq+bpp-2bpq+bqq+cp-cq+d\ \dots \ (3a)}$

${\displaystyle (2a)+(3a),+2appp+6apqq+2bpp+2bqq+2cp+2d\ \dots \ (4)}$

${\displaystyle (2a)-(3a),+6appq+2aqqq+4bpq+2cq\ \dots \ (5)}$

Reduce ${\displaystyle (4)}$ and ${\displaystyle (5)}$ and substitute ${\displaystyle Q}$ for ${\displaystyle qq}$:

${\displaystyle +3Qap+Qb+appp+bpp+cp+d\ \dots \ (4a)}$

${\displaystyle +Qa+3app+2bp+c\ \dots \ (5a)}$

Combine ${\displaystyle (4a)}$ and ${\displaystyle (5a)}$ to eliminate ${\displaystyle Q}$ and produce a function in ${\displaystyle p}$:

${\displaystyle (-8aa)p^{3}+(-8ab)p^{2}+(-2ac-2bb)p+(+ad-bc)\ \dots \ (6)}$

From ${\displaystyle (6),\ c0=ad-bc.}$

If ${\displaystyle c0==0,\ p=0}$ is a solution and function ${\displaystyle (5a)}$ becomes:

${\displaystyle Qa+c=0\ \dots \ (5d)}$

${\displaystyle Q={\frac {-c}{a}}}$

${\displaystyle q={\sqrt {Q}}}$ and two roots of ${\displaystyle (1)}$ are ${\displaystyle 0\pm q}$.

## An example

Figure 2.

The roots of equal absolute value are ${\displaystyle 3,-3.}$

See Figure 2.

${\displaystyle y=x^{3}+2x^{2}-9x-18}$

${\displaystyle c0=ad-bc=1(-18)-2(-9)=0.}$

The function has roots of equal absolute value.

${\displaystyle Q={\frac {-c}{a}}={\frac {9}{1}}=9;\ q={\sqrt {Q}}={\sqrt {9}}=\pm 3}$

The roots of equal absolute value are ${\displaystyle 3,-3}$.

# Equal Roots

Combine ${\displaystyle 4(a)}$ and ${\displaystyle 5(a)}$ from above to eliminate ${\displaystyle p}$ and produce a function in ${\displaystyle Q}$:

${\displaystyle (64aaaaa)Q^{4}+}$ ${\displaystyle (160aaaac-32aaabb)Q^{3}+}$ ${\displaystyle (132aaacc-56aabbc+4abbbb)Q^{2}+}$ ${\displaystyle (27aaadd-18aabcd+40aaccc+4abbbd-25abbcc+4bbbbc)Q+}$ ${\displaystyle (27aacdd-18abccd+4acccc+4bbbcd-bbccc)\ \dots \ (8)}$

From ${\displaystyle (8)}$ above: ${\displaystyle C0=27aacdd-18abccd+4ac^{4}+4b^{3}cd-bbc^{3}}$ ${\displaystyle =c(27aadd-18abcd+4ac^{3}+4b^{3}d-bbcc)}$

If ${\displaystyle C0==0}$, then ${\displaystyle Q=0}$ is a solution , ${\displaystyle x=p\pm 0=p}$ and ${\displaystyle (4a),(5a)}$ become:

${\displaystyle ax^{3}+bx^{2}+cx+d\ \dots \ (4e)}$

${\displaystyle 3ax^{2}+2bx+c\ \dots \ (5e)}$

If ${\displaystyle C0==0}$ because ${\displaystyle c=0}$, there is a stationary point where ${\displaystyle x=0}$.

Note that ${\displaystyle 27aadd-18abcd+4accc+4bbbd-bbcc}$ is the discriminant of the cubic formula. If ${\displaystyle C0==0}$ because the discriminant is ${\displaystyle 0}$, function ${\displaystyle (1)}$ contains at least 2 roots equal to ${\displaystyle x\pm 0}$ when both functions ${\displaystyle (4e),(5e)}$ are ${\displaystyle 0}$.

Note that ${\displaystyle (4e),(5e)}$ are functions of the curve and the slope of the curve. In other words, equal roots occur where the curve and the slope of the curve are both zero.

${\displaystyle (4e)}$ and ${\displaystyle (5e)}$ can be combined to produce:

${\displaystyle (ac)x^{2}+(-3ad+bc)x+(-2bd+cc)\ \dots \ (4f)}$

${\displaystyle (3a)x^{2}+(2b)x+(c)\ \dots \ (5f)}$

${\displaystyle (4f)}$ and ${\displaystyle (5f)}$ can be combined to produce:

${\displaystyle (-9ad+bc)x+(-6bd+2cc)\ \dots \ (4g)}$

${\displaystyle (+6abd-2acc)x+(-3acd+4bbd-bcc)\ \dots \ (5g)}$

If the original function ${\displaystyle (1)}$ contains 3 unique roots, then ${\displaystyle (4g),(5g)}$ are numerically different.

If the original function ${\displaystyle (1)}$ contains exactly 2 equal roots, then ${\displaystyle (4g),(5g)}$ are numerically identical, and the 2 roots have the value ${\displaystyle x}$ in ${\displaystyle (4g)}$.

If the original function ${\displaystyle (1)}$ contains 3 equal roots, then ${\displaystyle (4g),(5g)}$ are both null, ${\displaystyle (4f),(5f)}$ are numerically identical and ${\displaystyle x={\frac {-b}{3a}}}$.

From equations (4g) and (5g):

${\displaystyle -(+6abd-2acc)(-6bd+2cc)+(-3acd+4bbd-bcc)(-9ad+bc)}$ ${\displaystyle =+27aacdd-18abccd+4acccc+4bbbcd-bbccc}$ ${\displaystyle =C0}$

## Examples

### No equal roots

 Figure 3a. Cubic function with 3 unique, real roots at ${\displaystyle (-2,0),(1,0),(3,0)}$. Consider function ${\displaystyle y=x^{3}-2x^{2}-5x+6=(x+2)(x-1)(x-3)}$ from ${\displaystyle 4(g),\ x={\frac {-(-9ad+bc)}{(-6bd+2cc)}}={\frac {44}{122}}}$ from ${\displaystyle 5(g),\ x={\frac {-(+6abd-2acc)}{(-3acd+4bbd-bcc)}}={\frac {122}{236}}}$ ${\displaystyle 4(g),5(g)}$ are numerically different.

### Exactly 2 equal roots

 Figure 3b. Cubic function with 2 equal, real roots at ${\displaystyle (-1,0)}$. Consider function ${\displaystyle y=x^{3}-3x^{2}-9x-5=(x+1)(x+1)(x-5)}$ from ${\displaystyle 4(g),\ x={\frac {-72}{72}}=-1}$ from ${\displaystyle 5(g),\ x={\frac {72}{-72}}=-1}$ There are 2 equal roots at ${\displaystyle x=-1.}$

### 3 equal roots

 Figure 3c. Cubic function with 3 equal, real roots at ${\displaystyle (-3,0)}$. Consider function ${\displaystyle y=x^{3}+9x^{2}+27x+27=(x+3)(x+3)(x+3)}$ from ${\displaystyle 4(g),x={\frac {0}{0}}}$ from ${\displaystyle 4(f),\ 27x^{2}+162x+243=x^{2}+6x+9=0}$ from ${\displaystyle 5(f),\ 3x^{2}+18x+27=x^{2}+6x+9=0}$ ${\displaystyle 4(f),5(f)}$ are numerically identical, the discriminant of each is ${\displaystyle 0}$ and ${\displaystyle x={\frac {-6}{2}}=-3}$

# Depressed cubic

The depressed cubic may be used to solve the cubic equation.

In the cubic function: ${\displaystyle y=f(x)=ax^{3}+bx^{2}+cx+d}$ let ${\displaystyle x={\frac {-b+t}{3a}}}$, substitute for ${\displaystyle x}$ and expand:

${\displaystyle y={\frac {t^{3}+(9ac-3bb)t+(27aad-9abc+2b^{3})}{27a^{2}}}}$

In the depressed function the coefficient of ${\displaystyle t^{3}}$ is ${\displaystyle 1}$ and the coefficient of ${\displaystyle t^{2}}$ is ${\displaystyle 0}$.

When the function is equated to ${\displaystyle 0}$, the depressed equation is:

${\displaystyle t^{3}+At+B=0}$ where

${\displaystyle A=(9ac-3bb)}$ and

${\displaystyle B=(27aad-9abc+2b^{3})}$

Be prepared for the possibility that one or both of ${\displaystyle A,B}$ may be zero.

## When A = 0

 Figure 4a. Cubic function with slope 0 at point of inflection ${\displaystyle (0.5,-0.5)}$. This condition occurs when the cubic function in ${\displaystyle x}$ has exactly one stationary point or when slope at point of inflection is zero. ${\displaystyle f(x)=4x^{3}-6x^{2}+3x-1}$ ${\displaystyle f(t)=t^{3}-216}$ ${\displaystyle t={\sqrt[{3}]{216}}=6}$ ${\displaystyle x={\frac {-b+t}{3a}}={\frac {6+6}{3(4)}}=1}$ The other roots may be derived from the associated quadratic: ${\displaystyle y=4x^{2}+(4(1)+(-6))x+4(1)(1)+(-6)(1)+3}$${\displaystyle =4x^{2}-2x+1}$ ${\displaystyle x={\frac {2\pm {\sqrt {4-16}}}{8}}}$ ${\displaystyle ={\frac {2\pm {\sqrt {12}}{\sqrt {-1}}}{8}}}$ ${\displaystyle ={\frac {2\pm (2{\sqrt {3}}){\sqrt {-1}}}{8}}}$ ${\displaystyle ={\frac {1\pm {\sqrt {3}}{\sqrt {-1}}}{4}}}$

## When B = 0

 Figure 4b. Cubic function with point of inflection ${\displaystyle (-3,0)}$ on ${\displaystyle X}$ axis. This condition occurs when the cubic function in ${\displaystyle x}$ is of format ${\displaystyle (x+g)(x+g+h)(x+g-h)}$ or when point of inflection is on the ${\displaystyle X}$ axis. ${\displaystyle f(x)=x^{3}+9x^{2}+31x+39}$ ${\displaystyle f(t)=t^{3}+36t=t(t^{2}+36)}$ ${\displaystyle x={\frac {-b}{3a}}={\frac {-9}{3(1)}}=-3}$ ${\displaystyle t^{2}=-36;\ t={\sqrt {-36}}={\sqrt {36(-1)}}=\pm 6{\sqrt {-1}}}$ ${\displaystyle x={\frac {-b+t}{3a}}={\frac {-9\pm 6{\sqrt {-1}}}{3(1)}}=-3\pm 2{\sqrt {-1}}}$

## When A = B = 0

 Figure 4c (same as 3c above). Cubic function with: * point of inflection ${\displaystyle (-3,0)}$ on ${\displaystyle X}$ axis, * slope ${\displaystyle 0}$ at point of inflection. This condition occurs when: slope at point of inflection is ${\displaystyle 0}$, and point of inflection is on ${\displaystyle X}$ axis. Consider function ${\displaystyle y=x^{3}+9x^{2}+27x+27=(x+3)(x+3)(x+3)}$ ${\displaystyle f(t)=t^{3}+(9ac-3bb)t+(27aad-9abc+2b^{3})}$ ${\displaystyle =t^{3}+(9.1.27-3.9.9)t+(27.1.1.27-9.1.9.27+2.9.9.9)}$ ${\displaystyle =t^{3}+(0)t+(0)}$ ${\displaystyle x={\frac {-b+t}{3a}}={\frac {-b}{3a}}={\frac {-9}{3}}=-3}$

# Vieta's substitution

Let the depressed cubic be written as: ${\displaystyle t^{3}-3Ct+B}$ where ${\displaystyle C=b^{2}-3ac}$ and ${\displaystyle A=-3C}$

Let ${\displaystyle t=w+{\frac {C}{w}}={\frac {w^{2}+C}{w}}}$

Substitute for ${\displaystyle t}$ in the depressed function:

${\displaystyle f(w)=w^{6}+Bw^{3}+C^{3}}$

${\displaystyle f(W)=W^{2}+BW+C^{3}}$ where ${\displaystyle W=w^{3}}$ and ${\displaystyle w={\sqrt[{3}]{W}}}$.

From the quadratic formula: ${\displaystyle W={\frac {-B\pm {\sqrt {B^{2}-4C^{3}}}}{2}}}$

The discriminant ${\displaystyle =B^{2}-4C^{3}}$. Substitute for ${\displaystyle B,C}$ and expand:

This discriminant = ${\displaystyle 27a^{2}(27aadd-18abcd+4ac^{3}+4b^{3}d-bbcc)}$

The factor ${\displaystyle (27aadd-18abcd+4ac^{3}+4b^{3}d-bbcc)}$ is a factor of ${\displaystyle C0}$ above.

## Discriminant ${\displaystyle (B^{2}-4C^{3})==0}$

 Figure 5a. Cubic function with 2 equal, real roots at ${\displaystyle (-1,0)}$. If discriminant ${\displaystyle (B^{2}-4C^{3})==0}$, the function contains at least 2 equal, real roots. Consider function ${\displaystyle y=x^{3}-3x^{2}-9x-5}$${\displaystyle =(x+1)(x+1)(x-5)}$ ${\displaystyle W={\frac {-B}{2}}=216}$ ${\displaystyle w={\sqrt[{3}]{216}}=6}$ ${\displaystyle t=w+{\frac {C}{w}}=6+{\frac {36}{6}}=12}$ ${\displaystyle x={\frac {-b+t}{3a}}={\frac {3+12}{3}}=5}$ Associated quadratic ${\displaystyle =x^{2}+(1.5+-3)x+(1.5.5+-3.5+-9)}$ ${\displaystyle =x^{2}+2x+1=(x+1)(x+1)}$ The 2 equal roots are: ${\displaystyle (-1,0),(-1,0)}$.

## Discriminant ${\displaystyle (B^{2}-4C^{3})}$ positive

 Figure 5b. Cubic function with discriminant ${\displaystyle (B^{2}-4C^{3})}$ positive and 1 real root at ${\displaystyle (5,0)}$. If discriminant ${\displaystyle (B^{2}-4C^{3})}$ is positive, the function contains exactly 1 real root. Consider function ${\displaystyle y=x^{3}-3x^{2}-5x-25}$ discriminant ${\displaystyle =B^{2}-4C^{3}=691200}$ ${\displaystyle r={\sqrt {691200}}=831.3843876330611}$ ${\displaystyle W={\frac {-B+r}{2}}=847.6921938165306}$ ${\displaystyle w={\sqrt[{3}]{W}}=9.464101615137753}$ ${\displaystyle t=w+{\frac {C}{w}}=12}$ or: ${\displaystyle W={\frac {-B-r}{2}}=16.307806183469438}$ ${\displaystyle w={\sqrt[{3}]{W}}=2.5358983848622447}$ ${\displaystyle t=w+{\frac {C}{w}}=12}$ ${\displaystyle x={\frac {-b+t}{3a}}=5}$ The associated quadratic is: ${\displaystyle x^{2}+(1.5+-3)x+(1.5.5+-3.5+-5)=x^{2}+2x+5}$ and the two complex roots are: ${\displaystyle {\frac {-2\pm {\sqrt {4-20}}}{2}}}$ ${\displaystyle ={\frac {-2\pm 4{\sqrt {-1}}}{2}}}$ ${\displaystyle =-1\pm 2{\sqrt {-1}}}$

## Discriminant ${\displaystyle (B^{2}-4C^{3})}$ negative

If discriminant ${\displaystyle (B^{2}-4C^{3})}$ is negative, the function contains 3 real roots and ${\displaystyle W}$ becomes the complex number ${\displaystyle {\frac {-B}{2}}\pm {\frac {\sqrt {4C^{3}-B^{2}}}{2}}{\sqrt {-1}}}$.

Let ${\displaystyle W_{mod}}$ be the modulus of ${\displaystyle W}$.

Let ${\displaystyle W_{real}}$ be the real part of ${\displaystyle W}$.

Let ${\displaystyle W_{imag}}$ be the imaginary part of ${\displaystyle W}$.

Then ${\displaystyle W_{real}={\frac {-B}{2}}}$

${\displaystyle W_{imag}={\frac {\sqrt {4C^{3}-B^{2}}}{2}}}$

${\displaystyle W_{mod}^{2}=W_{real}^{2}+W_{imag}^{2}={\frac {B^{2}}{4}}+{\frac {4C^{3}-B^{2}}{4}}=C^{3}.}$

${\displaystyle W_{mod}={\sqrt {C^{3}}}}$

Let ${\displaystyle W_{\phi }}$ be the phase of ${\displaystyle W}$.

Then ${\displaystyle \cos W_{\phi }={\frac {W_{real}}{W_{mod}}}}$ and ${\displaystyle W_{\phi }=\arccos(\cos W_{\phi })}$.

${\displaystyle w={\sqrt[{3}]{W}}}$. Therefore:

${\displaystyle w_{mod}={\sqrt[{3}]{W_{mod}}}={\sqrt {C}}}$

${\displaystyle w_{\phi }={\frac {W_{\phi }}{3}}}$

${\displaystyle w_{real}=w_{mod}*\cos(w_{\phi })}$

${\displaystyle t=2*w_{real}}$

### An example

 Figure 5c. Cubic function with 3 unique, real roots at ${\displaystyle (-2,0),(1,0),(3,0)}$. ${\displaystyle y=f(x)=x^{3}-2x^{2}-5x+6}$ in which ${\displaystyle a,b,c,d=1,-2,-5,6.}$ ${\displaystyle B=56}$ ${\displaystyle C=19}$ ${\displaystyle W_{real}={\frac {-B}{2}}=-28}$ ${\displaystyle W_{mod}={\sqrt {C^{3}}}=82.8190799272728}$ ${\displaystyle \cos W_{\phi }={\frac {W_{real}}{W_{mod}}}=-0.338086344651354}$ ${\displaystyle W_{\phi }=1.91567908829702}$ radians. ${\displaystyle w_{\phi }={\frac {W_{\phi }}{3}}=0.638559696099005}$ radians. ${\displaystyle \cos w_{\phi }=0.802955068546966}$ ${\displaystyle w_{mod}={\sqrt {C}}=4.35889894354067}$ ${\displaystyle w_{real}=w_{mod}*\cos w_{\phi }=3.5}$ ${\displaystyle t=2*w_{real}=7}$ ${\displaystyle x={\frac {-b+t}{3a}}=3}$

# Review of complex math

Figure 6a: Components of complex number Z.

Origin at point ${\displaystyle (0,0)}$.
${\displaystyle Z_{real}}$ parallel to ${\displaystyle X}$ axis.
${\displaystyle Z_{imag}}$ parallel to ${\displaystyle Y}$ axis.
${\displaystyle r=abs(Z)=Z_{mod}}$ = modulus of ${\displaystyle Z}$${\displaystyle ={\sqrt {Z_{real}^{2}+Z_{imag}^{2}}}}$
Angle ${\displaystyle \phi }$ is the phase of ${\displaystyle Z=\arctan {\frac {Z_{imag}}{Z_{real}}}}$ ${\displaystyle Z=r(\cos \phi +{\sqrt {-1}}\sin \phi )=Z_{real}+{\sqrt {-1}}Z_{imag}}$

Figure 6b: Complex numbers ${\displaystyle W}$ and ${\displaystyle w}$.

Origin at point ${\displaystyle (0,0)}$.
${\displaystyle W_{imag}={\frac {\sqrt {4C^{3}-B^{2}}}{2}}}$ (off image to left.)
${\displaystyle w^{3}=(w_{mod}(\cos w_{\phi }+i\sin w_{\phi }))^{3}}$
${\displaystyle =w_{mod}^{3}(\cos(3w_{\phi })+i\sin(3w_{\phi }))}$
${\displaystyle =W_{mod}(\cos W_{\phi }+i\sin W_{\phi })=W}$

A complex number contains a real part and an imaginary part, eg: ${\displaystyle {\sqrt {2}}+{\sqrt {2}}{\sqrt {-1}}.}$

In theoretical math the value ${\displaystyle {\sqrt {-1}}}$ is usually written as ${\displaystyle i}$. In the field of electrical engineering and computer language Python it is usually written as ${\displaystyle j}$.

The value ${\displaystyle {\sqrt {2}}+{\sqrt {2}}{\sqrt {-1}}}$ is a complex number expressed in rectangular format.

The value ${\displaystyle w=2(\cos 45^{\circ }+{\sqrt {-1}}\sin 45^{\circ })}$ is a complex number expressed in polar format where ${\displaystyle 2}$ is the modulus of ${\displaystyle w}$ or ${\displaystyle w_{mod}}$ and ${\displaystyle 45}$ is the phase of ${\displaystyle w}$ or ${\displaystyle w_{\phi }.}$

${\displaystyle 2(\cos 45^{\circ }+{\sqrt {-1}}\sin 45^{\circ })}$ ${\displaystyle =2({\frac {\sqrt {2}}{2}}+{\sqrt {-1}}{\frac {\sqrt {2}}{2}})}$ ${\displaystyle ={\sqrt {2}}+{\sqrt {-1}}{\sqrt {2}})}$

## Multiplication of complex numbers

${\displaystyle p(\cos A+i\sin A)q(\cos B+i\sin B)}$ ${\displaystyle =pq(\cos A\cos B+\cos Ai\sin B+i\sin A\cos B+i^{2}\sin A\sin B)}$ ${\displaystyle =pq(\cos A\cos B-\sin A\sin B+i(\sin A\cos B+\cos A\sin B))}$ ${\displaystyle =pq(\cos(A+B)+i\sin(A+B))}$

To multiply complex numbers, multiply the moduli and add the phases.

## Complex number cubed

${\displaystyle (p(\cos A+i\sin A))^{3}}$ ${\displaystyle =p(\cos A+i\sin A)p(\cos A+i\sin A)p(\cos A+i\sin A)}$ ${\displaystyle =p^{2}(\cos 2A+i\sin 2A)p(\cos A+i\sin A)}$ ${\displaystyle =p^{3}(\cos 3A+i\sin 3A)}$

## Cube root of complex number W

Let ${\displaystyle W=W_{mod}(\cos W_{\phi }+{\sqrt {-1}}\sin W_{\phi })}$ and ${\displaystyle w=w_{mod}(\cos w_{\phi }+{\sqrt {-1}}\sin w_{\phi })}$

If ${\displaystyle w={\sqrt[{3}]{W}}}$ then:

${\displaystyle w_{mod}={\sqrt[{3}]{W_{mod}}}}$ and

${\displaystyle w_{\phi }={\frac {W_{\phi }}{3}}.}$

## Complex number ${\displaystyle w+{\frac {C}{w}}}$

Let ${\displaystyle w=k+mi}$ where ${\displaystyle k=w_{real},m=w_{imag}.}$

${\displaystyle w+{\frac {C}{w}}={\frac {k(C+k^{2}+m^{2})+im(k^{2}+m^{2}-C)}{k^{2}+m^{2}}}}$

If ${\displaystyle k^{2}+m^{2}==C:}$

${\displaystyle w+{\frac {C}{w}}={\frac {k(C+C)+im(C-C)}{C}}={\frac {2Ck}{C}}=2k}$

In the case of 3 real roots, ${\displaystyle t=2w_{real}}$

# cos ${\displaystyle {\frac {A}{3}}}$

The method above for calculating ${\displaystyle \cos w_{phi}}$ depends upon calculating the value of angle ${\displaystyle w_{phi}.}$

However, ${\displaystyle \cos w_{phi}}$ may be calculated from ${\displaystyle \cos W_{phi}}$ because ${\displaystyle w_{phi}={\frac {W_{phi}}{3}}.}$

Generally, when ${\displaystyle \cos A}$ is known, there are 3 possible values of the third angle because ${\displaystyle \cos 3({\frac {A}{3}}\pm 120^{\circ })=\cos(A\pm 360^{\circ })=\cos(A).}$

This suggests that there is a cubic relationship between ${\displaystyle \cos {\frac {A}{3}}}$ and ${\displaystyle \cos A.}$

## Expansion of ${\displaystyle \cos 3A}$

Figure 7a.

Graph of ${\displaystyle \cos 3A.}$

The well known identity for ${\displaystyle \cos 3A}$ is:

${\displaystyle \cos 3A=4\cos ^{3}A-3\cos A.}$

The derivation of this identity may help understanding and interpreting the curve of ${\displaystyle \cos 3A.}$

Let ${\displaystyle \cos 3A=a\cos ^{3}A+b\cos ^{2}A+c\cos A+d.}$

${\displaystyle \cos 90^{\circ }=0}$ and ${\displaystyle \cos 270^{\circ }=0}$

Therefore the point ${\displaystyle (0,0)}$ is on the curve and ${\displaystyle d=0.}$

 A 3A cos A cos 3A 0 0 1 1 180 180*3 -l -1 60 180 0.5 -1

Three simultaneous equations may be created from the above table:

${\displaystyle 1=1a+1b+1c}$

${\displaystyle -1=-1a+1b-1c}$

Therefore ${\displaystyle b=0.}$

${\displaystyle 1=1a+1c}$

${\displaystyle -1={\frac {a}{8}}+{\frac {c}{2}}}$

${\displaystyle a=4}$ and ${\displaystyle c=-3.}$

When ${\displaystyle \cos 3A}$ is known, ${\displaystyle 4\cos ^{3}A-3\cos A-\cos 3A=0.}$

## Newton's Method

Figure 7b.

Newton's Method used to calculate ${\displaystyle \cos A}$ when ${\displaystyle \cos 3A=0.1.}$

Newton's method is a simple and fast root finding method that can be applied effectively to the calculation of ${\displaystyle \cos A}$ when ${\displaystyle \cos 3A}$ is known because:

• the function is continuous in the area under search.
• the derivative of the function is continuous in the area under search.
• the method avoids proximity to stationary points.
• a suitable starting point is easily chosen.

See Figure 7b.

Perl code used to calculate ${\displaystyle \cos A}$ when ${\displaystyle \cos 3A=0.1}$ is:

$cos3A = 0.1;$x = 1; # starting point.
$y = 4*$x*$x*$x - 3*$x -$cos3A;

while(abs($y) > 0.00000000000001){$s = 12*$x*$x - 3; # slope of curve at x.
$delta_x =$y/$s;$x -= $delta_x;$y = 4*$x*$x*$x - 3*$x - $cos3A; print " x=$x
y=$y "; } print " cos(A) =$x
";

x=0.9
y=0.116

x=0.882738095238095
y=0.00319753789412588

x=0.882234602936352
y=2.68482638085543e-06

x=0.882234179465815
y=1.89812054962601e-12

x=0.882234179465516
y=-3.60822483003176e-16

cos(A) = 0.882234179465516

### When ${\displaystyle \cos(3A)}$ is positive

 Figure 7c. Newton's Method used to calculate ${\displaystyle \cos A}$ when ${\displaystyle \cos 3A=0.4.}$ When ${\displaystyle \cos(3A)=0.4,}$ output of the above code is: x=0.933333333333333 y=0.0521481481481486 x=0.926336712383224 y=0.000546900278781126 x=0.926261765753783 y=6.24370847246425e-08 x=0.926261757195518 y=7.7715611723761e-16 cos(A) = 0.926261757195518 If all 3 values of ${\displaystyle \cos A}$ are required, the other 2 values can be calculated as roots of the associated quadratic function with coefficients ${\displaystyle (a1,b1,c1)=(4,4cosA,4cos^{2}A-3)}$ x1 = -0.136742508909433 x2 = -0.789519248286085

### When ${\displaystyle \cos(3A)}$ is negative

 Figure 7d. Newton's Method used to calculate ${\displaystyle \cos A}$ when ${\displaystyle \cos 3A=-0.2.}$ When ${\displaystyle \cos 3A}$ is negative, the starting value of ${\displaystyle x=-1.}$ When ${\displaystyle \cos 3A=-0.2,}$ output of the above code is: x=-0.911111111111111 y=-0.0920054869684496 x=-0.89789474513884 y=-0.00190051666894692 x=-0.897610005610658 y=-8.73486682706481e-07 x=-0.89760987462259 y=-1.8446355554147e-13 x=-0.897609874622562 y=-1.66533453693773e-16 cos(A) = -0.897609874622562

### An example

 Figure 7e. Cubic function with 3 unique, real roots at ${\displaystyle (-2,0),(1,0),(3,0)}$. ${\displaystyle y=f(x)=x^{3}-2x^{2}-5x+6}$ in which ${\displaystyle a,b,c,d=1,-2,-5,6.}$ ${\displaystyle B=56}$ ${\displaystyle C=19}$ ${\displaystyle W_{real}={\frac {-B}{2}}=-28}$ ${\displaystyle W_{mod}={\sqrt {C^{3}}}=82.8190799272728}$ ${\displaystyle \cos W_{\phi }={\frac {W_{real}}{W_{mod}}}=-0.338086344651354}$ Use the code beside Figure 7b above with initial conditions: $cosWphi = -0.338086344651354;$cos3A = $cosWphi;$x = -1; # starting point.  ${\displaystyle \cos w_{\phi }=-0.917662935482248}$ ${\displaystyle w_{mod}={\sqrt {C}}=4.35889894354067}$ ${\displaystyle w_{real}=w_{mod}*\cos w_{\phi }=-4}$ ${\displaystyle t=2*w_{real}=-8}$ ${\displaystyle x={\frac {-b+t}{3a}}=-2}$

# Point of Inflection

The Point of Inflection is the point at which the slope of the curve is minimum.

After taking the first and second derivatives value ${\displaystyle x}$ at point of inflection is:

${\displaystyle x_{poi}={\frac {-b}{3a}}.}$

The slope at point of inflection is:

${\displaystyle s_{poi}={\frac {3ac-b^{2}}{3a}}.}$

Value ${\displaystyle y}$ at point of inflection is:

${\displaystyle y_{poi}={\frac {2b^{3}-9abc+27a^{2}d}{27a^{2}}}.}$

## Depressed cubic

Recall from "Depressed cubic" above:

${\displaystyle A=9ac-3b^{2}}$

${\displaystyle B=27a^{2}d-9abc+2b^{3}}$

Therefore:

${\displaystyle s_{poi}={\frac {A}{9a}}}$

${\displaystyle y_{poi}={\frac {B}{27a^{2}}}}$

If 1 of ${\displaystyle A,B}$ is zero, the cubic equation may be solved as under "Depressed cubic" above.

## Newton's Method

If both ${\displaystyle A,B}$ of the depressed function are non-zero, Newton's method may be applied to the original cubic function, and the Point of Inflection offers a convenient starting point.

### slope at PoI positive

 Figure 8a. ${\displaystyle y={\frac {x^{3}+9x^{2}+52x+152}{25}}}$ Cubic function with positive slope at Point of Inflection ${\displaystyle (-3,2).}$ ${\displaystyle A=0.36}$ ${\displaystyle B=0.0864}$ ${\displaystyle x_{poi}=-3}$ ${\displaystyle s_{poi}=1}$ ${\displaystyle y_{poi}=2}$

### slope at PoI negative

#### PoI above X axis

 Figure 8b. ${\displaystyle y={\frac {x^{3}+9x^{2}+2x-28}{10}}}$ Cubic function with negative slope at Point of Inflection ${\displaystyle (-3,2)}$ and PoI above ${\displaystyle X}$ axis. ${\displaystyle A=-2.25}$ ${\displaystyle B=0.54}$ ${\displaystyle x_{poi}=-3}$ ${\displaystyle s_{poi}=-2.5}$ ${\displaystyle y_{poi}=2}$ When ${\displaystyle y==y_{poi},}$ the other 2 intercepts may be calculated as roots of the associated quadratic with coefficients: ${\displaystyle (a_{1},\ b_{1},\ c_{1})}$ ${\displaystyle =(a,\ ax_{poi}+b,\ ax_{poi}^{2}+bx_{poi}+c)}$ ${\displaystyle =(0.1,0.6,-1.6).}$ ${\displaystyle (x_{1a},x_{1b})=(-8,2).}$ ($a,$b,$c,$d) = (0.1,0.9,0.2,-2.8); ($x,$y) = ($x1a,$ypoi); while(abs($y) > 1e-14){$s = 3*$a*$x*$x + 2*$b*$x +$c; $delta_x =$y/$s;$x -= $delta_x ;$y = $a*$x*$x*$x + $b*$x*$x +$c*$x +$d; print " x=$x,y=$y "; } print " x=\$x ";  x=-8.4,y=-0.246400000000004 x=-8.36056338028169,y=-0.00251336673084257 x=-8.36015274586958,y=-2.7116352896428e-07 x=-8.36015270155726,y=-8.88178419700125e-16 x=-8.36015270155726

#### PoI below X axis

 Figure 8c. ${\displaystyle y={\frac {x^{3}-6x^{2}-13x-8}{10}}}$ Cubic function with negative slope at Point of Inflection ${\displaystyle (2,-5)}$ and PoI below ${\displaystyle X}$ axis. ${\displaystyle A=-2.25}$ ${\displaystyle B=-1.35}$ ${\displaystyle x_{poi}=2}$ ${\displaystyle s_{poi}=-2.5}$ ${\displaystyle y_{poi}=-5}$ When ${\displaystyle y==y_{poi},}$ the other 2 intercepts may be calculated as roots of the associated quadratic with coefficients: ${\displaystyle (a_{1},\ b_{1},\ c_{1})}$ ${\displaystyle =(0.1,-0.4,-2.1).}$ ${\displaystyle (x_{1a},x_{1b})=(-3,7).}$