# Why is it valid to treat units as variables?

I've always taken for granted the fact that units can be treated as variables in mathematical expressions. If you have an object that travels $$10m$$ in $$2s$$, you can simply divide the length by the time and get $$5m/s$$.

This works well and all, but I have started to get a bit uncomfortable with just accepting these mathematical manipulations as valid. It feels similar to treating $$dy/dx$$ as a fraction in calculus, it does the job most of the time, but it's not quite right.

To try and make sense of it, I went back to the definition of the division: $$n/m$$ means "how many times can $$m$$ fit in $$n$$". If we apply this to the velocity example above, we get: "how many times does $$2s$$ fit into $$10m$$". Not super helpful... I've tried a couple of different avenues and nothing really convinces me that treating units as variables is a valid concept. In other words, I would love to be able to understand why dividing $$10m$$ by $$2s$$ gives us a velocity. Not only from intuition but by using rigorous mathematical notions.

Just to be clear, I am not confused about how it works. I am aware that if an object travels $$10m$$ in $$2s$$ (without any acceleration), then after a single second, 5 meters would have been traveled, thus telling us that the object is traveling at $$5m/s$$. What confuses me is why we can treat units as mathematical variables (Edit: Variables that are only valid under multiplication/division).

Any help and or references to works discussing these matters would be greatly appreciated!

Why do units (from physics) behave like numbers?

Why does it make sense to multiply/divide units?

May I treat units (e.g. joules, grams, etc.) in equations as variables?

• I can’t find it, but somewhere there’s a classic post that views units as being conversion factors from some fundamental (and arbitrarily selected) set of “god units”. So in that viewpoint when you write 7 meters, or 7 m, the “m” is literally a number that converts from the fundamental unit of distance to meters, and we are literally multiplying 7 by m. Then arithmetic with units is just arithmetic with actual numbers. Aug 9, 2023 at 19:21
• @MoyenMedium From that viewpoint, yes, technically 7 m and 30 s could be added, as they’re both just numbers. But you wouldn’t choose to add them because it wouldn’t tell you anything useful. Aug 9, 2023 at 19:28
• In a related vein, I recall an exam once in which, having been told to set basic physical constants to be dimensionless, we were asked things like our height in Coulombs. For instance, if the speed of light is dimensionless, we have a way to convert length to time, and so on. Good luck forming intuition out of these conversions, though.
– lulu
Aug 9, 2023 at 19:32
• @lulu That is precisely why I am uncomfortable with it. Despite the fact that they are not variables, we still apply the same rules that work with division/multiplication. To feel comfortable with it, I think I would need a proper proof that validates this abuse of notation. For the same reason that there is a proof behind the abuse of notation employed by the chain rule, I feel like there should be something similar for the behavior of units. Aug 9, 2023 at 19:58
• Both this physics.se post and this blog post by Terry Tao might be relevant. They don't necessarily directly address the question of why units can sometimes be treated as variables, but they perhaps offer an alternative way of thinking about things that sidesteps thinking of them as variables to begin with. Perhaps. Aug 9, 2023 at 20:03

The following is a possible formalization of units as used in the natural sciences.

It does not by any means give physical intuitions on what it means to divide units. It does say though why we can treat them like variables. The question might be ill-posed (and not just that it could be clarified further) and a tldr would simply be "why couldn't we treat them like variables". Still I hope this formalization makes you feel more at home with the concept.

As Von Neumann said,

Young man, in mathematics you don't understand things. You just get used to them.

With this in mind, let's begin.

Intro:

Given a commutative ring ---such as the real numbers--- you can consider a new kind of "number system" called a polynomial ring. Usually we call that system $$\mathbb R[x]$$ for $$x$$ the name of our variable.

As with the complex numbers where you have a distinguished element $$i$$ such that $$i^2=-1$$, here you can have a distinguished element called $$m$$ (for meters) and you add no restrictions as with the complex numbers, so $$m^2$$ doesn't reduce to anything, nor does $$m^3$$, etc.

In this case it would be $$\mathbb R[m]$$ instead.

So $$m$$ is just a name in this case and operations work properly as one would expect. e.g:

$$(a+bm)(x+ym) = ax + (ay+bx)m + bym^2$$

and so on.

Formal variables vs usual variables:

Polynomial rings behave just as polynomials. (In $$\mathbb R$$ it's the same. More generally you'd have to consider a quotient, but it's almost there.)

Most importantly you have for each real number $$a$$, an "evaluation morphism" $$: \mathbb R[m] \rightarrow \mathbb R$$ that "evaluates". It's usually called $$\varepsilon_a$$. The $$\varepsilon$$ is just for evaluation: $$\varepsilon$$ is like a greek e.

So for instance $$\varepsilon_2\ (1+3m+2m^2) = 1+3\cdot2+2\cdot2^2 = 15$$.

In this way, the formal variable $$m$$ behaves like a variable in the usual sense.

More than one unit:

You can do this with as many variables as you want. You can have one for each unit.

So now we can have also $$s$$ for seconds. (Again, it's just a name.) And with this you can have elements like $$3ms+1$$ where you don't give any condition on multiplying or adding the different variable names so they just stay like that, the same way $$m^2$$ didn't reduce to anything before.

This number system would be written as $$\mathbb R[m,s]$$ or $$\mathbb R[m][s]$$.

Note, you can write $$2m+3s$$ but that doesn't reduce further. Addition of different units can be interpreted as having the two quantities separately. Formally if you forget multiplication, the sum $$am+bs$$ is equivalent to the vector $$(a,b)$$.

Division:

Finally we need a way to divide these variables. For this, we use the notion of localization of a ring.

Now we can do everything we want. We can have $$\frac ms$$ or more complicated stuff like $$3\frac ms + 2\frac{m^2}s - \frac{10\frac ms}{5 s}$$ and it works just like you'd expect.

And there you have it. Units are variables. (Or they behave like so, but in modern math behaving the same is being the same.)

• If you care about this stuff, you'd be interested in studying abstract algebra. The book "Contemporary Abstract Algebra" by Gallian is easy to read and has everything you'd want. Aug 9, 2023 at 23:32
• This is very interesting... but how does it answer the question?
– Jme
Aug 9, 2023 at 23:53
• @Jme I'm sorry, I thought it did. Can you say something about why it doesn't? (Genuinely asking.) Most definitely it's not an answer about physical interpretations, but this is a math forum. Furthermore I agree all I did was "model" units formally as mathematical objects but not give reasons to why this should be the correct way to model them if this is what you're referring to. But at least to me it's definitely an answer in the sense that it makes me feel more comfortable with the concept of units. Aug 10, 2023 at 0:20
• Ah, nevermind, ignore me. The question is a bit vague, this probably is the best answer you can give. Thanks :)
– Jme
Aug 10, 2023 at 0:39
• "It does not by any means give physical intuitions on what it means to divide units. It does say though why we can treat them like variables." I think this is the closest thing I can get to an answer for now. We define units, and then we attribute physical meanings to them. I am still uncomfortable with the idea of accepting $m*m =m^2$ as an area, or $m/s$ as a velocity (even though they are defined as such), but this may be because I still don't know what I'm uncomfortable with. Stepping back and reflecting on what I am trying to understand might be my best course of action for now.Thank you! Aug 10, 2023 at 14:42

Because it works well, and tells you what you can and can't do. For example, if you multiplied $$7$$ and $$2m$$, intuitively that means a length that is 7 times longer than 2 meters. If you do it algebraically, treating m as a variable, you get $$7(2m)=14m$$, which is correct. However, if you did $$7m*2m$$, you don't want a 1 dimensional value. You want a 2d value, in meters squared. If you do the algebra, $$7m(2m)=14m^2$$, which is, again, correct. As to the $$m\overs$$ intuition, I like to think of it as "how many meters can you move in one second?".

• Although I do understand that $7m*2m$ will have $m^2$ as units, this still doesn't prove its validity. I would love a way to confirm beyond a shadow of a doubt that it is valid. Saying "You don't want a 1-dimensional value" is unfortunately not enough to convince me that multiplying meters together will yield an area. What is so special about multiplication that it can transform length into another type of unit? I may be focusing my efforts in the wrong direction right now. It feels a bit like trying to understand why the speed of light is what it is... It just is. Aug 9, 2023 at 20:41
• @MoyenMedium I think you're touching upon the problem in your last sentence... before one can prove anything about "units" you would need what "units" are axiomatically, and in any framework that does that, it would likely simply include an axiom along the lines of "when you multiply two objects with the "unit" of length, the resulting object has a unit of length squared" so maybe you should first try to figure out what exactly it is that you are asking Aug 9, 2023 at 20:49
• @Carlyle This question has proven to be way more difficult to answer than I originally anticipated. I may put this to rest for now and come back to it once I have the proper mathematical background to answer it. Aug 9, 2023 at 20:55
• @MoyenMedium I don't think this question is difficult to answer, I think its difficult to formulate in a meaningful way, and once that has been done, the answer will likely be "by definition" Aug 9, 2023 at 20:59
• @MoyenMedium I mean... Yeah. The definition of area is that it's in 1 dimensional units squared. And if you multiply 1 dimensional units, you can think of that as setting them as the side lengths of a rectangle with the result as the area. It just is. Sorry I couldn't help you out :/
– Jme
Aug 9, 2023 at 21:04