I need to prove expression using mathematical induction $P(1)$ and $P(k+1)$, that:
$$ 1^2 + 2^2 + \dots + n^2 = \frac{1}{6}n(n + 1)(2n + 1) $$
Proving $P(1)$ gave no difficulties, however I was stuck with $P(k+1)$, I've reached this point:
$$ 1^2 + \dots + (k+1)^2 = 1^2 + \dots + k^2 + (k+1)^2 = \\ \frac{1}{6}k(k+1)(2k+1) + (k+1)^2 $$
I've checked answer from the exercise book, the next step would be:
$$ = \frac{1}{6}(k+1)(k(2k+1)+6(k+1)) $$
How it was converted like that? Could you provide some explanation?
Thank you in advance
If you look carefully at $\frac16k(k+1)(2k+1)+(k+1)^2$, you'll see that it's a sum of two terms, $\frac16k(k+1)(2k+1)$ and $(k+1)^2$. Both of these terms have a factor $(k+1)$, so we can factor it out: $$=(k+1)\left(\frac16k(2k+1)+(k+1)\right)$$ Next, we can move the $\frac16$ as follows: $$=\frac16(k+1)\left(k(2k+1)+6(k+1)\right).$$ And there you have it!
In general, in these situations, the trick is to factor or develop expressions in the right way. If you can't figure out how to go from expression A to expression B, maybe going from B to A can be easier.