<s>[INST] How does $n^4 + 6n^3 + 11n^2 + 6n + 1 = (n^2 + 3n + 1)^2?$ C++ student here, not quite familiar with these type of expressions. Can someone explain how does this work? I'm familiar with $(a+b)^2$ etc. mathematics but this seems to be like $(a+b+c)^2$ and having searched online, the opened form for this formula doesn't look much alike. Any help will be appreciated. Thanks!
 [/INST] $$\begin{align}(\color{red}{n^2}+\color{blue}{3n+1})^2&=(\color{red}{n^2})^2+2\color{red}{n^2}(\color{blue}{3n+1})+(\color{blue}{3n+1})^2\\&=n^4+2(3n^3+n^2)+(3n)^2+2(3n)(1)+1^2\\&=n^4+6n^3+2n^2+9n^2+6n+1\\&=n^4+6n^3+11n^2+6n+1\end{align}$$
</s>