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

Suppose I have two units, Tonks, $T$, and Borks, $B$, as well as the equation $\frac{50T}{20B}=x$. May I manipulate the equation as though $T$ and $B$ were the kinds of symbols that we learned to manipulate in math class? For example:

\begin{align} \frac{50T}{20B}&=x\\ 50T&=20Bx\\ \frac{50T}{20}&=Bx\\ \end{align}

• Note that if tonk and bork were actual units, their unit symbols would be printed in roman (upright) type. They would be printed in lower-case letters unless they were derived from a proper name. Thus, conforming unit symbols would be $\mathrm t$ and $\mathrm b$ (not $T$ and $B$). (However, $\mathrm t$ is actually used for the tonne and $\mathrm b$ is actually used for the barn.) Furthermore, a space is always used to separate the unit from the number. Therefore, your equation should probably read $\frac{50\ \mathrm t}{20\ \mathrm b}=x$.
– user7951
Commented Sep 23, 2015 at 19:53

Yes, you may. It is quite common to convert units into each other. The simplest conversion might be the prefixing of units, e.g. $$\mathrm{\frac{km}{m}}=1000 \Longleftrightarrow \mathrm{1~km = 1000~m}.$$

Another example is the interconversion of units of energy. In some parts of chemistry, it is still quite common to use calories, in others Joule, as a SI unit, has taken its place. $$\mathrm{\frac{cal}{J}}=4.184 \Longleftrightarrow \mathrm{1~cal = 4.184~J}.$$

In principle, all units are defined to be constants, special numbers in a wider sense. You can treat them as such.

• It may be worth explicitly discussing units like F and C which don't have "natural" zero points. Can you still treat them as constants?
– R.M.
Commented May 15, 2015 at 15:04
• If you mean Fahrenheit and Celsius, I agree and will try to cover that as soon as i get the chance. Commented May 15, 2015 at 15:15
• @R.M. Is it even allowed to use F and C in equations? I mean, what would 2*10°C be? How about 2*0°C? Easy to run into contradictions
– Kos
Commented May 15, 2015 at 15:39
• @jvriesem: Watch out, those symbols you wrote there are not the units, but represent the numeric values of a value given a specific unit. It's The temperature in degrees Fahrenheit is 9/5 times the temperature in degrees Celsius plus 32, not 1 degree Fahrenheit is .... You correctly wrote them in italics.
– Yogu
Commented May 15, 2015 at 19:38
• You would probably have more success working with Kelvins and degrees Rankine. Commented May 16, 2015 at 3:11

Treating units as if they were algebra is called “dimensional analysis”.

One example given in that article is the question of how many seconds are there in two years.

$$2\ \mathrm{yr} \times 365\ \mathrm{day}\ \mathrm{yr}^{-1} \times 24\ \mathrm{hr}\ \mathrm{day}^{-1} \times 60\ \mathrm{min}\ \mathrm{hr}^{-1} \times 60\ \mathrm{s}\ \mathrm{min}^{-1} = 63072000\ \mathrm{s}$$

Another example question is,

How many atoms of hydrogen can be found in 45 g of ammonia, $$\ce{NH3}$$?

This is how I would approach this:

$$45\ \mathrm{g}\ \ce{NH3}\ /\ 17\ \mathrm{g}\ \mathrm{mol}^{-1} \approx 2.647\ \ce{NH3}\ \mathrm{mol}$$ $$2.647\ \ce{NH3}\ \mathrm{mol}\ \times\ 6.02 \times 10^{23}\ \mathrm{molecules}\ \mathrm{mol}^{-1} \approx 1.594 \times 10^{24}\ \ce{NH3}\ \mathrm{molecules}$$ $$1.594 \times 10^{24}\ \ce{NH3}\ \mathrm{molecules} \times 3\ \mathrm{(H\ atoms)}\ \mathrm{(\ce{NH3}\ molecules)}^{-1} \approx 4.781 \times 10^{24}\ \ce{H}\ \mathrm{atoms}$$

The article works this out differently, as a single step. I myself find the multi-step approach easier to follow, but everyone’s different. The article renders this as,

$$45\ \mathrm{g}\ \ce{NH3} \times \frac{1\ \mathrm{mol}\ \ce{NH3}}{17\ \mathrm{g}\ \ce{NH3}} \times \frac{6.02 \times 10^{23}\ \mathrm{molecules}\ \ce{NH3}}{1\ \mathrm{mol}\ \ce{NH3}} \times \frac{3\ \mathrm{atoms}\ \ce{H}}{1\ \mathrm{molecule}\ \ce{NH3}}$$

$$= 4.8 \times 10^{24}\ \mathrm{atoms}\ \ce{H}$$

(to 2 significant figures)

If the units cancel out correctly, that is further indication that you have the right formula. (And if they don’t cancel out correctly, that is a certain indication that you don’t have the right formula.)

• One cannot stress enough how important dimensional analysis is and the realization that dimensions can be treated algebraically in the same manner as numbers. As TRiG says If you can master dimensions you're likely never to make mistakes again in your computations. And there is much more ... check out Buckingham's PI theorem to see where dimensions can be used to infer mathematical relationships of physical systems. Commented May 14, 2015 at 14:33
• Of course, depending on what genre of music you prefer, you may be able to simplify this further by using either 86400 s day^-1 or 525600 min yr^-1 - bearing in mind that for the latter you are embedding an assumption about non-leap years into how you measure a year. Commented May 14, 2015 at 16:05
• @docscience And the units themselves, not just the dimensions, can be treated as algebraic variables. In my example, there's just the one dimension (I may add more examples when I'm not on a train), and more of the values are simple conversions.
– TRiG
Commented May 14, 2015 at 17:37

Not only may you, but you absolutely should. As a physics professor, watching students toss away the information contained in units is incredibly frustrating. Typically students drop the units, "do the math," and then put back on whatever final units they think should be there (if they bother with the last step at all). This leads to a shockingly large number of mistakes (even multi-million dollar ones: http://www.cnn.com/TECH/space/9909/30/mars.metric/)

Whenever you write a physical value you should write both the number and the unit and "do the math" on both, exactly as you propose. If the units don't work out to a unit that you expect then you know that you've done something wrong.

You not only can, but also must treat symbols for units by the ordinary rules of algebra, since unit symbols are mathematical entities and not abbreviations.

The value of a quantity is expressed as the product of a number and a unit. That number is called the numerical value of the quantity expressed in this unit.

This relation may be expressed in the form

$$Q = \left\{ Q \right\} \cdot \left[ Q \right]$$

where $Q$ is the symbol for the quantity, $\left[ Q \right]$ is the symbol for the unit, and $\left\{ Q \right\}$ is the symbol for the numerical value of the quantity $Q$ expressed in the unit $\left[ Q \right]$.

For example, the mass of a sample is

$$m = 100\ \mathrm g$$

Here, $m$ is the symbol for the quantity mass, $\mathrm g$ is the symbol for the unit gram (a unit of mass), and $100$ is the numerical value of the mass expressed in grams. Thus, the value of the mass is $100\ \mathrm g$.

It is important to distinguish between the quantity $Q$ itself and the numerical value $\left\{ Q \right\}$ of the quantity expressed in a particular unit $\left[ Q \right]$. The value of a particular quantity $Q$ is independent of the choice of unit $\left[ Q \right]$, although the numerical value $\left\{ Q \right\}$ will be different for different units.

For example, changing the unit for the mass in the previous example from the gram to the kilogram, which is $10^3$ times the gram, leads to a numerical value which is $10^{-3}$ the numerical value of the mass expressed in grams, whereas the value of the mass stays the same.

$$m = 100\ \mathrm g = 0.100\ \mathrm{kg}$$

Since symbols for units are mathematical entities, both the numerical value and the unit may be treated by the ordinary rules of algebra. For example, the equation $m = 100\ \mathrm g$ may equally be written $$m/\mathrm g = 100$$

It is often convenient to label the axes of a graph in this way, so that the tick marks are labelled only with numbers. The quotient of a quantity and a unit may also be used in this way for the heading of a column in a table, so that the entries in the table are all simply numbers.

Performing the mathematical operations of quantities is called quantity calculus. Quantities are multiplied and divided by one another according to the rules of algebra, resulting in new quantities.

The quotient of two quantities, $Q_1$ and $Q_2$, satisfies the relation \begin{align} \frac{Q_1}{Q_2} &= \frac{ \left\{ Q_1 \right\} \cdot \left[ Q_1 \right] }{ \left\{ Q_2 \right\} \cdot \left[ Q_2 \right] } \\[6pt] &= \frac{ \left\{ Q_1 \right\} }{ \left\{ Q_2 \right\} } \cdot \frac{ \left[ Q_1 \right] }{ \left[ Q_2 \right] } \end{align} Thus, the quotient $\left\{ Q_1 \right\}/\left\{ Q_2 \right\}$ is the numerical value $\left\{ Q_1/Q_2 \right\}$ of the quantity $Q_1/Q_2$, and the quotient $\left[ Q_1 \right]/\left[ Q_2 \right]$ is the unit $\left[ Q_1/Q_2 \right]$ of the quantity $Q_1/Q_2$.

For example, assuming a volume of $V = 0.127\ \mathrm{l}$, the density $\rho$ of the above-mentioned sample is \begin{align} \rho &= \frac{m}{V} \\[6pt] &= \frac{ 0.100\ \mathrm{kg} }{ 0.127\ \mathrm{l} } \\[6pt] &= \frac{ 0.100 }{ 0.127 } \cdot \frac{ \mathrm{kg} }{ \mathrm{l} } \\[6pt] &= 0.79\ \mathrm{kg/l} \end{align}

Similarly, the product of two quantities, $Q_1$ and $Q_2$, satisfies the relation \begin{align} Q_1 \cdot Q_2 &= \left( \left\{ Q_1 \right\} \cdot \left[ Q_1 \right] \right) \cdot \left( \left\{ Q_2 \right\} \cdot \left[ Q_2 \right] \right) \\[6pt] &= \left\{ Q_1 \right\}\left\{ Q_2 \right\} \cdot \left[ Q_1 \right] \left[ Q_2 \right] \end{align}

Thus, the product $\left\{ Q_1 \right\}\left\{ Q_2 \right\}$ is the numerical value $\left\{ Q_1Q_2 \right\}$ of the quantity $Q_1Q_2$, and the product $\left[ Q_1 \right]\left[ Q_2 \right]$ is the unit $\left[ Q_1Q_2 \right]$ of the quantity $Q_1Q_2$.

For example, considering the standard acceleration of free fall $g_\mathrm n = 9.80665\ \mathrm{m/s^2}$, the weight $F_\mathrm g$ of the above-mentioned sample is \begin{align} F_\mathrm g &= m \cdot g_\mathrm n \\[6pt] &= 0.100\ \mathrm{kg} \times 9.80665\ \frac{\mathrm m}{\mathrm{s^2}} \\[6pt] &= 0.100 \times 9.80665 \times \mathrm{kg} \cdot \frac{\mathrm m}{\mathrm{s^2}} \\[6pt] &= 0.98\ \frac{\mathrm {kg\ m}}{\mathrm{s^2}} \\[6pt] &= 0.98\ \mathrm{N} \end{align}

In forming products and quotients of unit symbols, the normal rules of algebraic multiplication or division apply.

For example, the expansion work $W$ at constant pressure $p = 100\,000\ \mathrm{Pa} = 100\,000\ \mathrm{kg\ m^{-1}\ s^{-2}}$ associated with a volume change of $\Delta V = 0.5\ \mathrm{m^3}$ is

\begin{align} W &= p \cdot \Delta V \\[6pt] &= 100\,000\ \frac{\mathrm{kg}}{\mathrm{m\ s^{2}}} \times 0.5\ \mathrm{m^3}\\[6pt] &= 50\,000\ \frac{\mathrm{kg}}{\mathrm{m\ s^{2}}}\cdot\mathrm{m^3}\\[6pt] &= 50\,000\ \frac{\mathrm{kg\ m^2}}{\mathrm{s^{2}}}\\[6pt] &= 50\,000\ \mathrm J \end{align}

Two or more quantities cannot be added or subtracted unless they belong to the same kind. The expression shall be written as the sum or difference of expressions for the quantities $$l=12\ \mathrm m-7\ \mathrm m$$ or parentheses shall be used to combine the numerical values, placing the common unit symbol after the complete numerical value $$l=\left(12-7\right)\ \mathrm m$$ but it is not permissible to write $$l=12-7\ \mathrm m\quad\color{red}{\small\text{(wrong!)}}$$ For the same reason, quantities on each side of an equal sign in an equation must be of the same kind \begin{align} m_\text{total} &= m_1+m_2 \\ 1.8\ \mathrm{kg} &= 1.5\ \mathrm{kg}+0.3\ \mathrm{kg} \end{align} However, quantities of the same kind do not necessarily have the same unit. $$250\ \mathrm g = 0.250\ \mathrm{kg}$$ $$10\ \mathrm{m/s} = 36\ \mathrm{km/h}$$ Anyway, quantities on each side of an equal sign in an equation must not be of different kinds.

$$1\ \mathrm{mol} = 22.414\ \mathrm l\quad\color{red}{\small\text{(wrong!)}}$$

May I manipulate the equation as though $T$ and $B$ were the kinds of symbols that we learned to manipulate in math class?

Yes, you can and should (that is, never leave out the units when you plug values into an equation: a quantity is always the product of a numerical value and a unit, and leaving out units is asking for disaster). The set of rules that govern the algebraic manipulation of quantities is known as quantity calculus.

Among the several references that can be found about quantity calculus and quantity equations (others can be found in this answer on Academia.SE), I suggest you in particular this guide, §7.11, and the following paper, which is geared toward chemists:

1. M J ten Hoor, "Quantity calculus for chemists", Chemistry in action n. 57, 1999. Online

However, units are not variables (we strongly believe that units should be immutable quantities: whether they are actually so is a matter of scientific investigation), and to highlight this fact it is recommended to use an upright typeface to typeset the units, instead of the italic typeface reserved to variable quantities. So your quantity equations would be better written as

$$\frac{50\,\mathrm{T}}{20\,\mathrm{B}} = x.$$

## Absolutely!

Having taught physics and planetary science for years now, this is how I've seen unit conversion taught most effectively.

### Example

Suppose we wish to convert 423 feet to kilometers, where we know $3280.4 \; \text{ft} = 1 \; \text{km}$, or $\frac{1 \; \text{km} }{3280.4 \; \text{ft}} =1$:

$$\require{cancel} 423 \; \text{ft} = \left( 423 \; \text{ft} \right) \times 1 = \left( 423 \; \text{ft} \right) \times \left( \frac{1 \; \text{km} }{3280.4 \; \text{ft}} \right) = \frac{423 \; \text{ft} \; \text{km}}{3280.4 \; \text{ft}} = \frac{423}{3280.4} \frac{\cancel{\text{ft}} \; \text{km}}{\cancel{\text{ft}}} \approx 0.129 \; \text{km}$$

### There are a few catches, however...

First, radians are a pseudo-unit. Angular frequency ($\omega$) and regular frequency ($f$) are two closely related quantities: $\omega=2\pi f$, but they have different units. The units of angular frequency are radians per unit time (e.g. rad/sec), whereas the units of regular frequency are "per unit time" (e.g. [cycles, counts, etc.]/sec or Hz). Many scientists disregard radians as a unit and give angular and regular frequency the same units. This is acceptable, but you should be aware of the context, as an angular frequency of 20 Hz is not the same as an ordinary frequency of 20 Hz.

Second, some (particularly chemists) have an unfortunate tendency to be pretty loose with units in some situations—especially when it comes to calculating equilibrium constants and dimensional laws. For example, it is not permitted for the argument of a natural logarithm or exponential to have units. Many people calculate $\ln(P) = ...$ (as for the Clausius-Clapeyron equation), while it ought to be something like $\ln(\frac{P}{P_0}) = ...$, where $P_0$ is a standard pressure scale used to scale all pressures in an equation. In most cases, this scale factor cancels out in the equation, but if you are keeping track of units, this is essential. Because this factor cancels out, calculations can usually be done correctly without thinking about it, and many chemists simply choose to ignore it or are even unaware of it (including some professors I've known!). Some old textbooks still do this, too, so this sloppiness is prevalent. The bottom line is that understanding the context is important!

Third, this effectively only works for units that are directly proportional to each other. One example of this not working is when converting between degrees Fahrenheit and degrees Celsius and Kelvins. The units can (and should) still be treated as variables, but because these unit systems are not directly proportional to each other, special care must be taken with them. The conversion formulae must be used.

• Radians should technically not be included as a unit because it is a ratio not a true unit.
– bon
Commented May 15, 2015 at 19:32
• @bon SI officially recognizes both the radian and steradian as "dimensionless derived units", but does effectively call them optional.
– R.M.
Commented May 15, 2015 at 22:45
• @bon: regardless of what one thinks "should be" a unit, nearly anything CAN be used as units, just like "counts" or "cycles" or "gross" or "dozen". They can be manipulated algebraically in the same way as ordinary units. That's what the original poster (OP) was asking about. Commented May 16, 2015 at 19:14
• Another catch: degrees Celsius & Fahrenheit behave oddly.
– TRiG
Commented May 25, 2015 at 13:24
• @bon: Using radians as a unit can help differentiate certain quantities. The one that comes to mind is angular frequency (often $\omega$), which has units of rad/sec, vs. ordinary frequency (often $f$ or $\nu$), which has units of cycles or events (or some countable quantity) per second, though it is usually abbreviated as "per second", $\pu{s^{-1}}$, or Hz. Since they are related by $\omega = 2 \pi f$, the units (or context) help to distinguish which variable is given. Commented Sep 24, 2015 at 16:59