What justifies dimensional analysis?

Physics is independent of our choice of units

And for something like a length plus a time, there is no way to uniquely specify a result that does not depend on the units you choose for the length or for the time.

Any measurable quantity belongs to some set $\mathcal{M}$. Often, this measurable quantity comes with some notion of "addition" or "concatenation". For example, the length of a rod $L \in \mathcal{L}$ is a measurable quantity. You can define an addition operation $+$ on $\mathcal{L}$ by saying that $L_1 + L_2$ is the length of the rod formed by sticking rods 1 and 2 end-to-end.

The fact that we attach a real number to it means that we have an isomorphism $$ u_{\mathcal{M}} \colon \mathcal{M} \to \mathbb{R}, $$ in which $$ u_{\mathcal{M}}(L_1 + L_2) = u_{\mathcal{M}}(L_1) + u_{\mathcal{M}}(L_2). $$ A choice of units is essentially a choice of this isomorphism. Recall that an isomorphism is invertible, so for any real number $x$ you have a possible measurement $u_{\mathcal{M}}^{-1}(x)$. I'm being fuzzy about whether $\mathbb{R}$ is the set of real numbers or just the positive numbers; i.e. whether these are groups, monoids, or something else. I don't think it matters a lot for this post and, more importantly, I haven't figured it all out.

Now, since physics should be independent of our choice of units, it should be independent of the particular isomorphisms $u_Q$, $u_R$, $u_S$, etc. that we use for our measurables $Q$, $R$, $S$, etc. A change of units is an automorphism of the real numbers; given two units $u_Q$ and $u'_Q$, the change of units is $$ \omega_{u,u'} \equiv u'_Q \circ u_Q^{-1}$$ or, equivalently, $$ \omega_{u,u'} \colon \mathbb{R} \to \mathbb{R} \ni \omega(x) = u'_Q(u_Q^{-1}(x)). $$ Therefore, \begin{align} \omega(x+y) &= u'_Q(u_Q^{-1}(x+y)) \\ &= u'_Q(u_Q^{-1}(x)+u_Q^{-1}(y)) \\ &= u'_Q(u_Q^{-1}(x)) + u'_Q(u_Q^{-1}(y)) \\ &= \omega(x) + \omega(y). \end{align}

So, since $\omega$ is an automorphism of the reals, it must be a rescaling $\omega(x) = \lambda x$ with some relative scale $\lambda$ (As pointed out by @WetSavannaAnimalakaRodVance, this requires the weak assumption that $\omega$ is a continuous function -- there are everywhere discontinuous solutions as well. Obviously units aren't useful if they are everywhere discontinuous; in particular, so that instrumental measurement error maps an allowed space of $u_\mathcal{M}$ into an interval of $\mathbb{R}$. If we allow the existence of an order operation on $\mathcal{M}$, or perhaps a unit-independent topology, this could be made more precise.).

Consider a typical physical formula, e.g., $$ F \colon Q \times R \to S \ni F(q,r) = s, $$ where $Q$, $R$, and $S$ are all additive measurable in the sense defined above. Give all three of these measurables units. Then there is a function $$ f \colon \mathbb{R} \times \mathbb{R} \to \mathbb{R} $$ defined by $$ f(x,y) = u_S(F(u_Q^{-1}(x),u_R^{-1}(y)). $$

The requirement that physics must be independent of units means that if the units for $Q$ and $R$ are scaled by some amounts $\lambda_Q$ and $\lambda_R$, then there must be a rescaling of $S$, $\lambda_S$, such that

$$ f(\lambda_Q x, \lambda_R y) = \lambda_S f(x,y). $$

For example, imagine the momentum function taking a mass $m \in M$ and a velocity $v \in V$ to give a momentum $p \in P$. Choosing $\text{kg}$ for mass, $\text{m/s}$ for velocity, and $\text{kg}\,\text{m/s}$ for momentum, this equation is $$ p(m,v) = m*v. $$ Now, if the mass unit is changed to $\text{g}$, it is scaled by $1000$, and if the velocity is changed to $\text{cm/s}$, it is scaled by $100$. Unit dependence requires that there be a rescaling of momentum such that $$ p(1000m,100v) = \lambda p(m,v). $$ This is simple -- $10^5 mv = \lambda mv$ and so $\lambda = 10^5$. In other words, $$ p[\text{g} \, \text{cm/s}] = 10^5 p[\text{kg} \, \text{m/s}]. $$

Now, let's consider a hypothetical situation where we have a quantity called "length plus time", defined that when length is measured in meters and time in seconds, and "length plus time" in some hypothetical unit called "meter+second", the equation for "length plus time" is $$ f(l,t) = l + t. $$ This is what you've said - $10 \text{ m} + 5 \text{ s} = 15 \text{ “m+s”}$. Now, is this equation invariant under a change of units? Change the length scale by $\lambda_L$ and the time scale by $\lambda_T$. Is there a number $\Lambda$ such that $$ f(\lambda_L l, \lambda_T t) = \lambda_L l + \lambda_T t $$ is equal to $$ \Lambda f(l,t) = \Lambda(l+t) $$ for all lengths and times $l$ and $t$? No! Therefore, this equation $f = l + t$ cannot be a valid representation in real numbers of a physical formula.


All right, I'm cashing in my comments to provide an answer:

Let's start with an example that doesn't invoke dimensions, units, or physics at all. How do we evaulate the following expression? $$ 1 + \begin{pmatrix}5\\2\\-9\end{pmatrix} + \begin{pmatrix}a\ b\\c\ d\end{pmatrix} $$

The answer is, we don't. Not without defining some special convention, like that every quantity is multiplied by some invisible matrix such that they all end up being $3\times3$ matrices... that's just arbitrary, and inconsistent.

Now, how do we interpret $5 \text{meter} + 10 \text{seconds}$? The answer is, we don't. Again, not without defining some arbitrary, inconsistent, and meaningless convention. You proposed it's equal to 15; well I will define $5\text{m}+10\mu \text{s}=15$ as well, and now we've just proven that microseconds equal seconds.

The lesson is, there's not a meaningful way to perform addition on disparate types of quantities. In physics, we refer to the general types as dimensions. Examples of dimensions are: length, time, energy, mass, etc. Units are specific ways to represent dimensions, for example meters and feet are both units of dimension length.

So, how does this relate to your comet example? You've observed (correctly) that we can in fact multiply different dimensions. E.g. mass times velocity has dimensions of momentum. But that still doesn't mean you can compare disparate quantities. The condition for your calculation to be correct is: $$ (\text{comet mass})\times(\text{period}) - (\text{the true speed}) = 0 $$ But as we've already shown, this expression is meaningless since we cannot add (or subtract) quantities of differing dimensions.


In physics, you're not allowed to ignore the units; they come along for the ride on every sub-step of every calculation. From a mathematics perspective, consider the units to be variables, so instead of 5 meters + 10 seconds, you have 5x + 10y. Unless you arbitrarily assign x = y = 1, there is no way you're getting 15 out of this; at the end of the day, you still have 5x + 10y, and physics is uninterested in complex numbers. At the end of a computation, you need one number, and "5x + 10y" is two numbers. And here's the rub in physics: you're not allowed to assign values to those variables. They are basic, irreducable units; you can't say "meters are 1".

On the other hand, you're allowed to multiply units like nobody's business. "Furlongs per fortnight" is a silly phrase, but you can use it and everyone will (after some conversion) understand exactly what you're saying:

$$13440\frac{\text{furlongs}}{\text{fortnight}} \times \frac{1 \; \text{mile}}{8 \; \text{furlongs}} = 1680\frac{\text{miles}}{\text{fortnight}}$$

$$1680 \frac{\text{miles}}{\text{fortnight}} \times \frac{1 \; \text{fortnight}}{336 \; \text{hours}} = 5 \frac{\text{miles}}{\text{hour}}$$

(Cue a horde of angry physicists descending upon me for my use of Imperial units.)

On every step of these conversions, the units never went away; they stayed with the numbers. When you're computing something in physics, the numbers you play with are real things; they represent a quantity of something, and that something doesn't go away just because you think it's inconvenient. So if an asteroid goes 10 meters in 5 seconds, it looks like this:

$$10 \; \text{meters} \times \frac{1}{5 \; \text{seconds}} = 2 \frac{\text{meters}}{\text{second}}$$

You can multiply and divide quantities however you like, and you'll end up with some funky units, but your final number will be valid — though they may be difficult to relate to everything else. (For instance, the viscosity of a fluid is measured in (kilograms per (meter * second)), which isn't particularly intuitive but is useful in the particular places that viscosity is used.)