How do I know which operations to do when solving an equation? For example, $$x = 5(\sin y) + 2 \tag1$$ If I wanted to make $y$ a function of $x$, $$\begin{align} x &= 5(\sin y) + 2 \tag2 \\[4pt] x - 2 &= 5(\sin y) \tag3 \\[4pt] \frac{x - 2}{5} &= \sin y \tag4 \\[4pt] y &= \sin^{-1}\left(\frac{x - 2}{5}\right) \tag5 \end{align}$$ I believe this is the correct answer, but I was wondering why it isn't this way:
$$\begin{align} x &= 5(\sin y) + 2 \tag6 \\ \frac{x}{5} &= (\sin y) + 2 \tag7 \\ \frac{x}{5} - 2 &= \sin y \tag8 \\ y &= \sin^{-1}\left(\frac{x}{5} - 2\right) \tag9 \end{align}$$
Why is equation $(9)$ wrong?
@player3236's comment has already correctly pointed out the issue in your calculation: you simply make a mistake from (6) to (7) because you forgot to divide $2$ by $5$ as well.
In general, when you divide a nonzero constant into both sides of a equation, you need to do it for each term. To see a simpler example, if you have $$ x=5y+2 $$ then, after dividing by $5$ on both sides, you get $$ \frac15x=y+\frac25 $$ instead of $$ \frac15x=y+2 $$
To fix your problem, check the following correct lines:
$$\begin{align} x &= 5(\sin y) + 2 \tag6 \\ \frac{x}{5} &= (\sin y) + \color{red}{\frac{2}{5}} \tag{7'} \\ \frac{x}{5} - \color{red}{\frac{2}{5}} &= \sin y \tag{8'} \\ y &= \sin^{-1}\left(\frac{x}{5} - \color{red}{\frac{2}{5}}\right) = \sin^{-1}\left(\color{red}{\frac{x-2}{5}}\right) \tag{9'} \end{align}$$