# Should one include the unit in the variable? E.g. should one write $x^\circ = 30^\circ$ or $x = 30^\circ$?

I sometimes come across equations like

$$x^\circ = 180^\circ - \frac{360^\circ}{n}$$

where I would write

$$x = 180^\circ - \frac{360^\circ}{n}$$,

or like

$$3 \text{ cm} + x \text{ cm} = 5 \text{ cm}$$

where I would write

$$3 \text{ cm} + x = 5 \text{ cm}$$.

I wonder which style is recommended and why.

Should one include the unit in the variable?

• Best, I think, is to let $x$ represent a pure number without a dimension hiding behind the symbol. Thus, say something like "let $x$ be the number of degrees" or "let $x$ be the number of centimeters" (or variations, such as "the length and width are, respectively, $5 \; \text{cm}$ and $x \; \text{cm}),$ and then in simple situations use pure numbers (e.g. $5$ and $x)$ when working with equations. Of course, in some situations it's better to have the units in the equations, or at least some of the equations for explanatory or set-up or dimensional check reasons (continued) Commented Jan 12, 2023 at 11:11
• (e.g. some of the in-line equations here, or in beginning chemistry work with moles and such, etc.), but even then you should probably have the variables themselves represent pure numbers. Commented Jan 12, 2023 at 11:17
• Do you know of any students getting confused by one convention or the other? No sense in solving a problem that doesn't exist. Commented Jan 30, 2023 at 18:55

The usual physics convention is that variables have units built into them, so you don't need to (indeed, shouldn't) write the units separately. For example, Wikipedia writes

In classical mechanics, the kinetic energy of a non-rotating object of mass $$m$$ traveling at a speed $$v$$ is $$\tfrac{1}{2}mv^{2}$$.

not

In classical mechanics, the kinetic energy of a non-rotating object of mass $$m$$ kilograms traveling at a speed $$v$$ meters per second is $$\tfrac{1}{2}mv^{2}$$ joules.

The first sentence definitely seems clearer to me!

• I had forgotten this when I wrote my comments! And this despite having taken, during 1980-84, several graduate courses in physics at each of two different universities. Commented Jan 12, 2023 at 15:24

As far as the centimeters are concerned, I believe that both are possible, but there's a catch:

$$3 \text{cm} + x = 5 \text{cm}$$

Solution:

• $$x = 2 \text{cm}$$ => correct.
• $$x = 0.2 \text{dm}$$ => correct.
• $$x = 0.02 \text{m}$$ => correct.

$$3 \text{cm} + x \text{cm} = 5 \text{cm}$$

• $$x = 2$$ => correct (no unit).
• $$x = 0.2 \text{dm}$$ or $$x = 0.02\text{m}$$ => wrong (unit must be centimeters, as it is mentioned)
• And in the second example $x=2\mathrm{cm}$ is just as wrong as $x=0.02\mathrm{m}$. Commented Jan 12, 2023 at 14:25
• @WillOrrick: except that it's just a way to mention that the student has noticed the correct unit). Commented Dec 14, 2023 at 15:33

This must certainly depend on the context. In the examples you present here, the units/dimensions do nothing, so I would just go ahead and forget them, taking them back in use to check if the answer makes sense.

In this case, writing $$3 \text{ cm} + x \text{ cm}$$ is a way of formalizing that the dimensions are ignored; certainly the next step is to divide away the centimetres and then calculate with the pure numbers.

However, if I was dealing with a more complicated case with several different units, then it would be more natural for me to think that the variable contains both numerical information and the units for it. That way I would not have to know the units in advance; rather, the outcome of the calculation would be $$a = \frac{3}{7} \frac{\text{m}}{\text{s}^2}$$ or something similar. Here $$a$$ corresponds to the actual acceleration, as opposed to the case where $$a$$ is an arbitrary numerical value that only is meaningful after we have given the dimensions.

I sometimes come across equations like

I) $$3 \text{ cm} + x \text{ cm} = 5 \text{ cm}$$

where I would write

II) $$3 \text{ cm} + x = 5 \text{ cm}$$.

Aside from the fact that option I allows the units to be immediately discarded and the ensuing presentation more succinct, consider the following declaration where, like in Option II, the variables encode both numerical values and units:

• If a sector has arc length $$s$$ and radius $$r$$ and its angle subtended at its circle's centre is $$\theta,$$ then $$s=\frac{\pi r\theta}{180}.$$

For $$(r,s)=(4\text{ cm},\pi\text{ cm}),$$ this formula is consistent with neither $$\theta{=}45^\circ$$ nor $$\theta{=}\frac{\pi}4$$ and wrongly refers to $$45$$ as an angle. The sensible way to fix this anomaly is to be explicit about the choice of units (e.g., gradians, degrees, natural circular measure rad) of the dimensionless quantity $$\theta,$$ as in option I:

• If a sector has arc length $$s$$ cm and radius $$r$$ cm and its angle subtended at its circle's centre is $$\theta$$ degrees, then $$s=\frac{\pi r\theta}{180}.$$
• Why would someone write the equation $s=\frac{\pi r \theta}{180}$ from your example? Why not simply $s=r\theta$ or alternatively $s=\frac{\pi r \theta}{180^\circ}$ (but in the latter case $\pi$ and $180^\circ$ cancel, since $180^\circ = \pi$). Commented Feb 1, 2023 at 11:46
• Maybe I can answer my own question: only someone who wants to adopt option I and fix degrees as units for the angle would write the equation you wrote. Someone who would want to use option II would simply write $s=r\theta$ (the more succinct presentation in this case) . Commented Feb 1, 2023 at 12:03
• 1. $s=\frac{\pi r \theta}{180^\circ},$ although uglier with the unit $^\circ,$ works; however, its declaration (the introduction defining its various symbols) still needs to specify/disambiguate the units of $\theta$ (as $^\circ$ rather than rad); hence, this alternative offers no benefit. $\quad$ 2. Yes, my contrived example is merely to point out that the units of dimensionless quantities are unable to reveal themself without assistance, unlike D Speyer's example whose quantities all have dimensions. Commented Feb 1, 2023 at 12:09
• Why do we need to specify units for $\theta$? You seem to agree that an angle is dimensionless (a pure number). Pure numbers have 1 as a canonical unit. (And rad =1 while $^\circ=\frac{pi}{180}\approx ​0.01745$.) Commented Feb 1, 2023 at 12:33

I believe the reason people often omit units in their variable names is rooted in the principle of economy in notation. This principle suggests that when conveying information, especially in scientific and mathematical contexts, one should strive for the most concise and efficient representation. In cases where the units of a variable are clear from the context or are universally understood, adding units to the variable name may be considered redundant. Therefore, to save time and simplify the notation, it's common to choose the shortest, yet still clear, representation. This approach prioritizes ease of writing and reading while maintaining sufficient clarity, provided the context supports it.