<s>[INST] How does $\frac{k^2(k+1)^2}{4} + (k+1)^3$ become $\frac{(k+1)^2(k+2)^2}{4}$? As part of an induction proof, the authors of a beginner combinatorics text reduce/factor a polynomial as follows, but do not show the minutiae of their algebraic steps:
$$\frac{k^2(k+1)^2}{4} + (k+1)^3 \tag1$$
manipulated to:
$$(k+1)^2\left(\frac{k^2}{4} + k + 1\right) \tag2$$
manipulated to:
$$\frac{(k+1)^2}{4}(k^2 + 4k + 4) \tag3$$
manipulated to:
$$\frac{(k+1)^2(k+2)^2}{4} \tag4$$
...which was the desired result.
I fear I'm missing some sort of basic algebra required to understand what factoring and reduction steps the authors took to produce the results above. Would anyone be kind enough to explain what algebraic rules/properties/factorization allowed the authors to produce the results as shown? I've been struggling to work it out on my own.
 [/INST] For (1), we can separate the $\frac{k^2}{4}$ from $(k+1)^2$ and move out a factor of $k+1$ from $(k+1)^3$, giving us
$$\frac{k^2}{4}(k+1)^2+(k+1)(k+1)^2$$
We can then collect like terms (specifically, the $(k+1)^2$ terms), giving us
$$(k+1)^2\left(\frac{k^2}{4}+k+1\right)$$
Which is (2).
From there, we can divide and multiply by $4$, giving us
$$(k+1)^2\cdot\frac{4}{4}\left(\frac{k^2}{4}+k+1\right)$$
Rearranging slightly gives
$$\frac{(k+1)^2}{4}\cdot4\left(\frac{k^2}{4}+k+1\right)$$
Applying the distributive law gives
$$\frac{(k+1)^2}{4}\left(k^2+4k+4\right)$$
Now we note that $k^2+4k+4=(k+2)^2$ (you can verify this yourself by expanding the RHS), thus we have the end result
$$\frac{k^2(k+1)^2}{4}+(k+1)^3=\frac{(k+1)^2(k+2)^2}{4}$$
</s>