Is there some kind of rigorous construction of units and Dimension analysis? I've always worked with units using some rules that were never strictly defined, such as $m×m=m^2$ or 'you can't add meters with seconds' for example, so i' ve wondered if there's some kind of intuition behind this because I feel like units can be treated as independent vectors, because '0 meters' is not the same as a dimensionless 0, just in the same way as $\vec{0}$ is not equal to a escalar 0. Furthermore I want to know why cant we extend units such that the exponential of a quantity with units becomes meaningful. So I want to know if there is a rigorous definition on this, since I think it may be deeper that it may seem
 A: Let me start by saying that this answer shows how you can mathematically model the sort of structure you're talking about, where units are fundamentally a part of their variables. For routine computations, the usual attitude of "units act like unknown non-zero variables and we shouldn't add things of different dimensions together" is quite effective and not inherently different from what is sketched here.

Let's start by dealing with a single kind of quantity: (signed) length. It's clear enough that lengths form a vector space: we know how to add them and we know how to scale them. Moreover, this ought to be a one dimensional vector space. Let's call this space $L$ and note that we can mark some point on it as $1\text{ meter}$ and then write $x\text{ meters}$ to mean $x$ times that. Easy enough - already $0\text{ meters}$ is a distinct entity from the scalar $0$.
So let's talk about area. The system of units we use chooses to define area in terms of the area of rectangles, so an area is essentially defined to be an expression of the form $\ell_1\cdot \ell_2$ for lengths $\ell_1$ and $\ell_2$ or some sum of such expressions subject to some reasonable rules:
$$(c\ell_1)\cdot \ell_2 = c(\ell_1\cdot \ell_2)$$
$$(\ell_1 + \ell'_1)\cdot \ell_2 = (\ell_1 \cdot \ell_2) + (\ell'_1 \cdot \ell_2)$$
with analogous rules for the second coordinate of the product - though one can prove, as a theorem from these rules, that $\ell_1\cdot \ell_2 = \ell_2\cdot \ell_1$. Then areas are, again, a one-dimensional space - which is exactly just the tensor product of the space of lengths with itself. Let's call the space of areas $L^2=L\otimes L$ and note that it is defined by this bilinear operator $\cdot : L\times L \rightarrow L^2$. Further note that now $1\text{ meter}^2$ is really defined as $(1\text{ meter})\cdot (1\text{ meter})$. Defining volume and higher quantities proceeds by a similar tensor product definition.
What about a quantity like spatial frequency which has units $(\text{meters})^{-1}$? Well, all we know about spatial frequencies is that we can count the periods of that frequency present in some length - that is, if $L^{-1}$ is the space of spatial frequencies, we expect that there is a bilinear operator $\cdot : L \times L^{-1}\rightarrow\mathbb R$ - and that's basically all we care about about that space.
We can synthesize these musing into a formal set of axioms:

(1) For each $n\in\mathbb Z$, we have a vector space $L^n$.
(2) The space $L^0$ is equal to $\mathbb R$.
(3) For every pair of integers $a,b$, there is a bilinear map $\cdot_{a,b} : L^a\times L^b\rightarrow L^{a+b}$.
(4) For every $a,b$ and every non-zero $\ell_1\in L^a$ and non-zero $\ell_2\in L^b$ we have that the maps $z\in L^b\mapsto \ell_1\cdot_{a,b} z$ and $z\in L^a\mapsto z\cdot_{a,b} \ell_2$ are bijections.
(5) For every $b\in\mathbb Z$ we have that $1\cdot_{0,b}z = z$.
(6) For every $\ell_1\in L^a$ and $\ell_2\in L^b$ and $\ell_3\in L^c$ we have the following associative law:
$$(\ell_1\cdot_{a,b} \ell_2)\cdot_{a+b,c}\ell_3 = \ell_1\cdot_{a,b+c}(\ell_2\cdot_{b,c}\ell_3).$$

where we usually write $\cdot$ without the indices to avoid cluttering equations, but recognize that there is in fact a set of operators rather than a single one. If you want to work with more kinds of quantities - like time - you would want to index your spaces in two variables, like $L^aT^b$ - which is as simple as changing $\mathbb Z$ in the above axioms to $\mathbb Z^2$ or $\mathbb Z^k$ where $k$ is however many "fundamental" quantities there are.
This abstraction is really not terribly useful, but it encodes an important property of calculations with physical significance: the only things you can do to measurements, in general, is the operations allowed in the structure of "a set of single-dimensional vector spaces with a collection of bilinear operators $\cdot$." In particular, you can scale quantities, you can add quantities living in the same vector space, and you can multiply any quantities and divide by quantity which is not zero in its vector space. You can also use that $\mathbb R$ is a particular one of these vector spaces and do whatever operations you want on these dimensionless quantities.
Note that this also explains why exponentiation and similar operators requires a dimensionless parameter: exponentiation is defined by some sort of power series
$$e^x=\sum_{n}\frac{x^n}{n!}$$
but the only way that $x^n$ could live in the same space as $1$ is if $x$ is in $\mathbb R$ - otherwise, each quantity $x^n$ lives in a different space, so cannot be added together.
A: Each physical quantity has a dimension you can think of as a vector. For example, if our basis is length, mass and time, power's vector is $\left(\begin{array}{c}2\\1\\-3\end{array}\right)$. The size of the quantity depends on the units used for those dimensions, e.g. 2 m is 200 cm. But let's fix units for each dimension that multiply in the obvious way, e.g. the unit of power is the squared unit of length times the unit of mass divided by the cubed unit of time. This is how the SI system of units works (with the unfortunate inconsistency that the unit of mass has a kilo- prefix.) Then each quantity has a dimensionless value (say $a$) and a dimension vector (say $v$), e.g. 10 W would pair $10$ with the above vector. And we can then formalise the rules as follows:


*

*$\sum_ia_i(b_i,\,v)=(\sum_ia_ib_i,\,v)$ (e.g. I can add lengths in the obvious way);

*$a\prod_i(a_i,\,v_i)^{c_i}=(a\prod_ia_i^{c_i},\,\sum_ic_iv_i)$ (e.g. I can do power-law physics calculations in the obvious way);

*If we change our units, we still honour the above "SI" rule (this actually follows from the first two bullet points).


There's no way in the context of these rules to add quantities with different vectors. For example, is 1m+2s equal to $3$ of something, or to $102$ of something if we switch to cm, $2001$ of something if we switch to ms, or what? Nor can a power series work unless all its terms are dimensionless. For example, we can't add 1m to 1m$^2$ (or is that 100 cm to 10,000cm$^2$?)
