Please help improve my proof by induction methods! I am attaching my workings which should make this clearer but the crux of this is that I have just proven by induction that the sum of the first n squares is: $\dfrac{n(n + 1)(2n + 1)}{6}$
The issue is that I did this by proving the base case $n = 1$, assuming it is true for arbitrary $n \leq k$ and then showing true for $k + 1$ and breaking down both sides of an equation to:
$$\dfrac{2k^3 + 9k^2 + 13k + 6}{6}$$
This took some time, including finding and correcting a mistake, and when I checked my answer at the back of the book it was proven in two lines as seen here:

By induction. True for $n=1$. If $n>1$, then
$$1^2+2^2+\dots+n^2=\left(1^2+2^2+\dots+(n-1)^2\right)+n^2=\\
\frac{(n-1)n(2n-1)}6+n^2=\frac{n(n+1)(2n+1)}6$$

Induction is something I understand with the ladder analogy, first prove the first step $n = 1$ is there, then assume an arbitrary step $k$ is there and prove the step after it $k + 1$ is there. If we can do that, we can set that random step to the first step, and use what we have proven with $k + 1$ to traverse the entire ladder. My understanding comes from what I read in Discrete Maths - Elementary and Beyond, and a video from Khan Academy and theTrevTutor.
I get that the author uses $n$ instead of $k$ but I do not understand how in that solution where $\frac{(n-1)n(2n-1)}6$ comes from and how it is used. Referencing the ladder analogy, I thought that perhaps the solution uses the step previous to $k$, $k - 1$, instead of the step after $k + 1$ but I cannot seem to work that out.
This kind of solution was provided for another problem I solved with more lines before this also, so I would love to understand what I am missing so I can apply it myself from now on. Can someone please explain this to me plainly?
This is my work:
https://i.imgur.com/B6HO0O5.png
https://i.imgur.com/VDtWV8M.png
 A: The first line of the solution is simply wrong: it should be
$$1^2+2^2+\ldots+(n-1)^2+n^2=\left(1^2+2^2+\ldots+(n-1)^2\right)+n^2\,.$$
The statement $P(n)$ about $n$ that we’re trying to prove for all $n\ge 1$ is that
$$1^2+2^2+\ldots+n^2=\frac{n(n+1)(2n+1)}6\,.\tag{1}$$
For the induction step you assumed $P(k)$ and proved that $P(k+1)$ holds; in the solution that you’ve been given, the induction step is done by assuming $P(n-1)$ and proving that $P(n)$ holds. If you substitute $n-1$ for $n$ in $(1)$, you ge
$$\begin{align*}
1^2+2^2+\ldots+(n-1)^2&=\frac{(n-1)n\big(2(n-1)+1\big)}6\\
&=\frac{(n-1)n(2n-1)}6\,.
\end{align*}$$
The last step of the proof that you’ve been given hides quite a bit of algebra:
$$\begin{align*}
\frac{(n-1)n(2n-1)}6+n^2&=\frac{n(n-1)(2n-1)+6n^2}6\\
&=\frac{n\left(2n^2-3n+1\right)+6n}6\\
&=\frac{n\left(2n^2+3n+1\right)}6\\
&=\frac{n(n+1)(2n+1)}6\,.
\end{align*}$$
It’s really just what you did, except that it shows that $P(n-1)$ implies $P(n)$ instead of showing that $P(n)$ implies $P(n+1)$, and leaves a lot of the algebra to the reader to check.
