I few days ago I solved a problem on a website called brilliant.org, I can not seem to find the problem there anymore but I still remember it:
Q: You go to a candy store to buy m&ms and twizzlers, 1 pack of m&ms is 1 dollar, and one pack of twizzlers is 0.5 dollars. If you buy a total of 10 packs worth 6 dollars in total, how many packs of m&ms did you buy?
The solution is simple, you form a system of linear equations where x is the number of m&ms and y is the number of twizzlers.
$x + y = 10$
$ x + \frac{y}{2} = 6$
Solving by subtracting the second equation from the first we eventually get x = 2, so we bought two packs if m&ms. However, from my physics classes I have learnt that you can not add or subtract two number having different units. I have tried multiple times to make the units match but with no success. For example, in the first equation x stands for the number of packets of m&ms and in the second x packets are being multiplied by 1 dollar per packet , so when we do x - x, we are subtracting dollars from packets? Also when we do 10 - 6, isn't it also packets - dollars? For this reason, subtracting the equations doesn't seem to make sense to me, so why are we still able to do so?
In the first equation, $x+y=10$, the unit is "packs": $x$ packs plus $y$ packs equals $10$ packs. However, you can divide each side by "packs" and you end up with the unit "packs/packs," which we would call the "empty unit", i.e. no unit. The second equation has the unit "dollars," but again we divide both sides by "dollars" and end up with pure numbers without units.
So the equations involve pure numbers: no units are involved.
Pure numbers, without units, also happen in physics, so it is not true that "all the equations ... had units." Many physics quantities are pure, such as coefficient of friction, mechanical advantage, and efficiency. So are sines, cosines, and tangents of angles. (There may be a dispute over the proper units for angles--radians or degrees--but everyone agrees that the trigonometric function values themselves have no units.) One physics equation that involves no unit is "the coefficient of static friction of rubber on dry concrete is ten times that of ice on ice."