How do I know when to introduce parenthesis in algebra? I quite often fail to come up with the right answer because I don't know the rules for parenthesis. Let's say I would like to expand(?) the first equation. What I did was use the quadratic identities and I got equation 2, which is wrong. The right way is equation 3. Is there a rule that I can learn so that I wouldn't make this mistake again? Are there maybe several rules? Any advice is much appreciated!
$$
\frac{(a+1)^2-(a-1)^2}{(b+1)^2-(b-1)^2} \tag{1}
$$
$$
\frac{a^2+2a+1-a^2-2a+1}{b^2+2b+1-b^2-2b+1} \tag{2}
$$
$$
\frac{a^2+2a+1-(a^2-2a+1)}{b^2+2b+1-(b^2-2b+1)} \tag{3}
$$

Let's do this first without variables because it will make it easier to understand. Say I know that the amount of money I have is
$$520-80$$
and let's say that for whatever reason I choose to use the fact that $80=40+40$ to write this as
$$520-(40+40)$$
Do you see why we used parenthesis? Because we replace the value $80$ with an equal value $40+40$, and in the first expression we subtracted the whole of $80$ and so to keep the same value we need to subtract the whole of $40+40$. If we didn't use parenthesis and wrote this instead as
$$520-40+40$$
then we would change the meaning of the expression.
Now back to your problem. Let's focus on just the numerator because the same thing is going on in the denominator.
$$(a+1)^2-(a-1)^2$$
Think of the $(a-1)^2$ as analogous to the $80$ above. We are now replacing $(a-1)^2$ with another value which is equal to it, just like we replaced $80$ with $40+40$. So you use
$$(a-1)^2 = a^2 - 2a + 1$$
and so the expression should become
$$(a+1)^2 - (a^2 - 2a + 1)$$
because just like we subtracted the whole of $(a-1)^2$ then we want to subtract all of $a^2-2a+1$. If we didn't use parenthesis here it would mean we subtracted only one part of $a^2-2a+1$ which would change the meaning of the expression.
