Just today I encountered a problem at brilliant.org:
As we saw in the last problem, when multiplying sums and differences, each term in each sum or difference must be multiplied by every term in the other. Geometrically, this can be thought of as finding the areas of all of the sections of a rectangle and summing them to find the total area. The area of the square below is the sum of the areas of the blue (9), yellow ($x^2$), and green ($3x$) rectangles:
It then shows me something like this:
$$ \begin{align} &(3 + x)^2\\ =& (3 + x)(3+x)\\ =& 9 + 3x + 3x + x^2\\ =& 9 + 6x + x^2 \end{align} $$
My question is:
Why is the $3x + 3x$ (line 3) there? How did it appear? It's possible to visualize it thanks to the rectangle in the picture above. But what if I had only $(3 + x)^2$ (the equation) and not the rectangle? How do I know why the $3x + 3x$ can be found in $(3 + x)^2$?
As far as I can tell, $(3 + x)(3 + x)$ can be written as $9(x^2)$. Is that correct?
~~(irrelevent) Can this question be tagged "abstract-algebra"?~~
Thank you in advance for taking your time to answer this question, it's really appreciated.