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?