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!
-
1$\begingroup$ You know how to do this if you know how to compute $131^2$, since $131=n^2+3n+1$ where $n=10.$ Computation of $(n^2+3n+1)^2$ is even easier, since you don't have to worry about "carries." $\endgroup$– Thomas AndrewsMar 23, 2018 at 15:52
-
2$\begingroup$ Try $$(a+b+c)^2=(a+(b+c))^2$$ $\endgroup$– DaveMar 23, 2018 at 15:53
-
$\begingroup$ Thanks guys! Makes sense now. $\endgroup$– IdaisaMar 24, 2018 at 15:52
-
1$\begingroup$ @Idaisa Please remember that you can choose an answer among the given if the OP is solved, more details here meta.stackexchange.com/questions/5234/… $\endgroup$– userMar 24, 2018 at 21:33
4 Answers
This uses a simple rule called distributivity. This rule says that for all numbers $a,b,c$ we have: $$a(b+c)=ab+ac$$ and: $$(a+b)c=ac+bc$$
Now, let's say we have some numbers $a$ $b$ and $c$ and we want to compute $(a+b+c)^2$. Using our rule, we obtain: \begin{align*} (a+b+c)^2 &= (a+b+c)(a+b+c)\\ &=a(a+b+c)+b(a+b+c)+c(a+b+c)\\ &=a^2+ab+ac+ba+b^2+bc+ca+cb+c^2\\ &= a^2+b^2+c^2+2ab+2bc+2ca. \end{align*}
If we put $n^2$ for $a$, $3n$ for $b$ and $1$ for $c$ to obtain: $$(n^2+3n+1)^2=(n^2)^2+(3n)^2+1^2+2n^2\cdot 3n+2n^2\cdot 1+2\cdot 3n\cdot 1$$ Simplifying this gives: \begin{align*} (n^2+3n+1)^2&=(n^2)^2+(3n)^2+1^2+2n^2\cdot 3n+2n^2\cdot 1+2\cdot 3n\cdot 1\\ &= n^4+9n^2+1+6n^3+2n^2+6n\\ &=n^4+6n^3+11n^2+6n+1 \end{align*} as desired.
-
$\begingroup$ This is very helpful and thorough, thank you for this! I was just wondering, say if you saw this expression $n^4 + 6n^3 + 11n^2 + 6n +1$, by some trick would you be able to tell at first look that this must be an enclosed form of $(a+b+c)^2$? $\endgroup$– IdaisaMar 24, 2018 at 15:50
-
$\begingroup$ @Idaisa What you could do is plug in some values of $n$ and notice the result is always a square number. Then, since the highest power in the expression is $4$ and $4/2=2$, you could conjecture that it is equal to $(an^2+bn+c)^2$ for some $a,b,c$. Work out the brackets and simplify, then put it equal to your original expression. You'd get equations like $a^2=1$, $2ab=6$ and so on. Finally, solve for $a$ ,$b$ and $c$. $\endgroup$– MastremMar 24, 2018 at 15:59
$$\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}$$
When you expand something squared, you multiply each term by each other term, so in this case you have $$\begin{aligned}(n^2+3n+1)^2&=n^2\cdot n^2 + n^2\cdot 3n+n^2\cdot 1\\&\;+3n\cdot n^2+3n\cdot3n+3n\cdot1\\&\;+1\cdot n^2+1\cdot3n+1\cdot1\\&=n^4+3n^3+n^2+3n^3+9n^2+3n+n^2+3n+1\\&=n^4+6n^3+11n^2+6n+1\end{aligned}$$