Robust to solve a given cubic equation: Given roots are complex

105 Views Asked by At

Devise the algorithm to find the roots of cubic equation: $7x^3 + 11x^2 + 5x-2=0$.

This question was asked in one of the quant finance interviews.

1

There are 1 best solutions below

2
On BEST ANSWER

Numerically, Newton's method should work - We start with a guess at the solution. Let's just let $x_0 = 1$ We now let our next guess, $x_1$, be $x_0 - \frac{f(x_0)}{f'(x_0)}$ (the derivative is easily calculated here with the power rule if you know any calculus... if you don't, the answer is $ 5 + 22 x + 21 x^2$) $$x_1 = x_0-\frac{f(x_0)}{f'(x_0)} = 1-\frac{21}{48} = \frac{27}{48}$$ $$x_2 = x_1-\frac{f(x_1)}{f'(x_1)} = \frac{27}{48}- \frac{22687}{98384} = \frac{16327}{49192}$$
Continuing this, we get that $x_8 \approx 0.2460098817120613$ which is only off by $\approx 4.4227 × 10^{-17}$

If you want an analytic solution, we first try the Rational Roots Theorem. Using the Rational Roots Theorem, we quickly find that any solutions will be of the form $\pm \frac{1,2}{1,7} = \{1,\frac 17, 2,\frac 27\}$
Plugging in and checking shows that no solutions exist, so we are forced to apply the cubic formula. It's not a super fun formula to use, but can be found online easily.