# How does ${n^2 - 9n = 0}$ turn into ${n(n - 9) = 0}$?

$${n^2 - 9n = 0}$$ How does that turn into ${n(n - 9) = 0}$?

Can someone, please, explain the logic behind this?

This arose in a problem involving the number of diagonals in a particular polygon:

\begin{align} \frac{n(n - 3)}{2} = 3n &\quad\to\quad n^2 - 3n = 6n \\ &\quad\to\quad n^2 - 9n = 0 \\[4pt] &\quad\to\quad n(n - 9) = 0 \\[4pt] &\quad\to\quad n = 0, 9 \end{align}

The problem is easy to solve. I just don't get how $n^2ā9n=0$ expands to $n(nā9)=0$.

Choose one vertex, $n$ choices, choose another one from the remaining ones which is not adjacent or equal, $n-3$ this gives $n^2-3n$. Now since you can do it in any order, you divide by $2$ to account for double counting giving
$$\#d = {1\over 2}n(n-3).$$
Not sure how you got the $9$. Clearly that's negative for a square, but there are $2$ diagonals for a square. Also not sure why you have the $=0$, are you sure this is how the problem was posed?
• @W.Zlacki well if that's all, just note that $n(n-9) = n\cdot n -n\cdot 9$ by the distributive property, so $n(n-9)=n^2-9n$ is the same way of saying this without so many multiplication symbols. – Adam Hughes May 29 '16 at 22:57
• You actually end up double counting the diagonals, so the final formula is $\frac{n(n-3)}{2}$ – Hrhm May 29 '16 at 23:01