The point is (as pointed out in the comments above) that $9\cdot 7 \equiv 1\pmod {31}$. That is, $9$ is the inverse of $7$ in the group $\mathbb{Z}_{31}^{\times}$.
You are trying to find an $x$ such that $7x \equiv 29 \pmod{31}$, that is, such that $7x = 29$ in the group $\mathbb{Z}_{31}^{\times}$. You are allowed to multiply by inverses, so is you do that
$$\begin{align}
7x &\equiv 29 \pmod{31} & & \Rightarrow\\
7^{-1}7x &\equiv 7^{-1}29 \pmod{31} & & \Rightarrow\\
9\cdot7x &\equiv 9\cdot 29 \pmod{31} & & \Rightarrow\\
63x &\equiv 261 \pmod{31} & &
\end{align}
$$
And modulo $31$ you have $63$ is $1$ and $261$ is $13$. So
$$
x \equiv 13 \pmod{31}
$$