The cubic formula
My son and I were trying to use the cubic formula the other day to find the roots of a cubic equation. It’s not as simple as the quadradic formula:
![Rendered by QuickLaTeX.com \[ \begin{array} {*{20}c} {x = \frac{{ - b \pm \sqrt {b^2 - 4ac} }}{{2a}}} & {{\rm{when}}} & {ax^2 + bx + c = 0} \\ \end{array}\]](http://nealabq.com/blog/wp-content/ql-cache/quicklatex.com-af918f82dcbe8306a37a1574778bd743_l3.png)
We used the method where you first convert the cubic into a depressed cubic. A depressed cubic is missing the
term. It looks like this:
![Rendered by QuickLaTeX.com \[ \begin{array} {*{20}c} {ax^3 + cx + d = 0} \\ \end{array}\]](http://nealabq.com/blog/wp-content/ql-cache/quicklatex.com-e46e36f599a39f0268d44d035e1c7898_l3.png)
You convert a normal cubic into a depressed cubic with a substitution. Starting with a general cubic polynomial:
![Rendered by QuickLaTeX.com \[ \begin{array} {*{20}c} {ax^3 + bx^2 + cx + d = 0} \\ \end{array}\]](http://nealabq.com/blog/wp-content/ql-cache/quicklatex.com-e24bc9f1637ba0a2829801c2556fa543_l3.png)
Make the substitution:
![Rendered by QuickLaTeX.com \[ \begin{array} {*{20}c} {x = y - \frac{b}{3a}} \\ \end{array}\]](http://nealabq.com/blog/wp-content/ql-cache/quicklatex.com-56e83660aec277e10f28a149e10463de_l3.png)
And you end up with the depressed cubic:
![Rendered by QuickLaTeX.com \[ \begin{array} {*{20}c} {ay^3 + (c - \frac{b^2}{3a})y + (d + \frac{2b^3}{27a^2} - \frac{bc}{3a}) = 0} \\ \end{array}\]](http://nealabq.com/blog/wp-content/ql-cache/quicklatex.com-07df61517f3c7b8d1989521793b1df8e_l3.png)
Finally you find the roots for the depressed cubic to solve for
and substitute back to find the roots for the original equation. Solving for the depressed cubic is a multi-step operation, but it’s not too difficult. The above link explains it nicely.
To make it easier, we decided to try to solve a cubic that was already depressed. We picked the following because one of the three roots (
) is obvious.
![Rendered by QuickLaTeX.com \[ \begin{array} {*{20}c} {x^3 + x - 2 = 0} \\ \end{array}\]](http://nealabq.com/blog/wp-content/ql-cache/quicklatex.com-63abd875e70e5065087d41b36f404ccf_l3.png)
The other two roots are easy to discover. Since
is a root, we know
can be expressed
where P is a quadratic expression. Long division yields
which tells us the other two roots are
.
So now we know what to expect.
When you solve this depressed quadratic you get:
![Rendered by QuickLaTeX.com \[ \begin{array} {*{20}c} {x_1 = \sqrt[3]{\sqrt{\frac{28}{27}} + 1} - \sqrt[3]{\sqrt{\frac{28}{27}} - 1}}\\ \end{array}\]](http://nealabq.com/blog/wp-content/ql-cache/quicklatex.com-b3618aaabd42f2a66c22a79a155493f3_l3.png)
If you put it thru a calculator, you’ll find the above expression indeed equals 1. I was a little surprised to find two irrationals separated by an integer in a non-obvious way. I also found it unsatisfying, since I could not simplify this expression all the way to 1 using algebra.
Let’s look at another cubic solution. Wikipedia tells us the following formula will give us the real root:
![Rendered by QuickLaTeX.com \[ \begin{array} {rl} {x_1 = } & {- \frac{b}{3a}} \\ {} & {- {\frac{1}{3a}}\sqrt[3]{\frac{1}{2}\left(Q + \sqrt{Q^2 - 4(b^2 - 3ac)^3}\right)}} \\ {} & {- {\frac{1}{3a}}\sqrt[3]{\frac{1}{2}\left(Q - \sqrt{Q^2 - 4(b^2 - 3ac)^3}\right)}} \\ \end{array}\]](http://nealabq.com/blog/wp-content/ql-cache/quicklatex.com-5aaf2afa1c21d1be29c9aa9fd27580c6_l3.png)
where
![Rendered by QuickLaTeX.com \[ \begin{array} {rl} {Q =} & {2b^3 - 9abc + 27a^2d} \\ \end{array}\]](http://nealabq.com/blog/wp-content/ql-cache/quicklatex.com-e494b69a346b06e2f00a754345484ece_l3.png)
To solve
we plug
,
,
, and
into the above to get:
![Rendered by QuickLaTeX.com \[ \begin{array} {rl} {x_1 =} & {- \frac{1}{3}\sqrt[3]{\frac{1}{2}\left[-54 + \sqrt{(54^2 + 4*27)}\right]}} \\ {} & {- \frac{1}{3}\sqrt[3]{\frac{1}{2}\left[-54 - \sqrt{(54^2 + 4*27)}\right]}} \\ \end{array}\]](http://nealabq.com/blog/wp-content/ql-cache/quicklatex.com-43ce68f8499ca3489108c13f20e9229d_l3.png)
which simplifies to
![Rendered by QuickLaTeX.com \[ \begin{array} {*{20}c} {x_1 = - \frac{1}{3}\left[\sqrt[3]{-27 + 6\sqrt{21}} + \sqrt[3]{-27 - 6\sqrt{21}}\right]} \\ \end{array}\]](http://nealabq.com/blog/wp-content/ql-cache/quicklatex.com-af7d718ed7d2a6672b17e51ea46a76ed_l3.png)
and finally evaluates (with a calculator) to:
![Rendered by QuickLaTeX.com \[ \begin{array} {*{20}c} {x_1 = 1}\\ \end{array}\]](http://nealabq.com/blog/wp-content/ql-cache/quicklatex.com-0db331e662d4f8a59ef4a61e4fa8c13e_l3.png)
Although that’s interesting, it’s no more satisfying than the first solution. I feel I’m missing something since I can’t take it all the way to
algebraically. It was still a fun exercise though. I’ve occasionally wondered about the methods for solving cubic equations, and now I’ve finally seen it done.
I can see why they don’t teach this in high school. It’s too complicated to ask people to memorize, so they wouldn’t want it on a test. And it gives funny looking results, full of square- and cube-roots, that are difficult to manipulate.
Hmmm, now I’m wondering about a general method for finding the roots of a 4th-order equation. Or even a for a 5th-order equation.
Powered by QuickLaTeX.com” and QuickLaTeX as a WordPress plugin.
Palindrome Squares
My son asks me “What do the numbers 26, 264, 307 and 836 all have in common?” After enjoying my puzzled look for a moment, he tells me all their squares are palindromes, but they’re not palindromes themselves.
Most palindrome squares are squares of palindromes, like (11 * 11) == 121, (121 * 121) == 14641, and (22 * 22) == 484. When the digits in palindrome number are small, so there is no carrying when you square, then the square is also a palindrome. But there are a few squares that are palindromes even with all the carrying. Like (307 * 307) == 94249.
Now I can’t let an 11 year-old show me up like that. I may not know all the squares to 1000, but I do know how to program, so I whipped up the following to find more of these squares.
# squares.py
# Python code to find squares that are palindromes.
__author__ = 'nealabq@gmail.com'
def is_palindrome( int_in_question) :
"""
True if int_in_question is an integer that is a
palindrome when written in base 10.
"""
# Change the number into a string and then a list.
as_list_of_chars = list( str( int_in_question))
# Copy the list and reverse it.
reversed_list_of_chars = list( as_list_of_chars)
reversed_list_of_chars.reverse( )
# True if the list of chars is palindromic.
return as_list_of_chars == reversed_list_of_chars
def print_palindrome_squares_up_to( limit) :
"""
Prints all the positive integers up to but not
including limit, where the integer's square is a
palindrome but the integer itself is not. Also
prints the square.
"""
for i in range( limit) :
if not is_palindrome( i) :
if is_palindrome( i * i) :
print( i, i * i)
Then I checked the first 100 million counting numbers. (This took a few minutes.)
>>> import squares >>> squares.print_palindrome_squares_up_to( 100000000) 26 676 264 69696 307 94249 836 698896 2285 5221225 2636 6948496 22865 522808225 24846 617323716 30693 942060249 798644 637832238736 1042151 1086078706801 1109111 1230127210321 1270869 1615108015161 2012748 4051154511504 2294675 5265533355625 3069307 9420645460249 11129361 123862676268321 12028229 144678292876441 12866669 165551171155561 30001253 900075181570009 64030648 4099923883299904 >>>
And there you have it. Integer sequence A059744.
Be sure to check out Feng Yuan’s palindrome page, which says 2,554,237,742,555,355,264,685,484 (more than 2 quindecillion) squared is palindrome 6524130445402999318864545454688139992045440314256.
Perfect Day
Today is June 28, or 6/28, and 6 and 28 are the first two perfect numbers. It could only be more perfect if the year were 496 or 8128.
Happy Perfect Day!