Instead of computing the two sums separately and subtracting them, we can build one combined formula for the difference and then plug in n = 20 directly.
The sum of cubes of the first n natural numbers is \(\left(\frac{n(n+1)}{2}\right)^2\), and the sum of squares is \(\frac{n(n+1)(2n+1)}{6}\). Subtracting the second from the first and pulling out the common factor n(n+1):
\[ \sum k^3 - \sum k^2 = n(n+1)\left[\frac{n(n+1)}{4} - \frac{2n+1}{6}\right] \]Taking the terms inside the bracket to a common denominator of 12:
\[ \frac{n(n+1)}{4} - \frac{2n+1}{6} = \frac{3n(n+1) - 2(2n+1)}{12} = \frac{3n^2 - n - 2}{12} \]The quadratic \(3n^2 - n - 2\) factors as \((3n+2)(n-1)\), so the whole difference simplifies to a single clean formula:
\[ \sum k^3 - \sum k^2 = \frac{n(n+1)(n-1)(3n+2)}{12} \]Now put n = 20 into this formula:
\[ \frac{20 \times 21 \times 19 \times 62}{12} \]Multiply the numerator step by step: 20 x 21 = 420, then 420 x 19 = 7980, then 7980 x 62 = 4,94,760. Dividing this by 12 gives 41,230.
Let's summarize:
So the required difference is 41230.