9
$\begingroup$

Apologies for terminology inconsistencies, as I'm reading a Chinese statistics and probabilities textbook while looking up intrinsics on an English encyclopedia.

This arose when I was reading the definition of expected value (a.k.a. mean according to my textbook) for a continuous random variable $x$ which is:

$$E(X)=\int^{\infty}_{-\infty}xf(x)\text{d}x$$

Where $x$ is the random variable, and $f(x)$ is the probability density function.

At first, I wasn't able to make sense of it : it's the product of 3 variables (I know $\text{d}x$ is a special symbol, but let's assume we're doing a brute-force calculation by setting it to a really small value) - which means the unit must be very strange. By unit, I mean things like meters, seconds, kilograms, etc. (I know all 3 are supposed to be from the set of real numbers, but let's suppose they've got types like programming language variables).

But then I thought: the $\text{d}x$ doesn't need to have a unit - it just need to approach a very small value whilst making sure everything's consistent.

So Q: Is my interpretation of the formula for expected value reasonable and sound? Can variable and its differential have different unit (as in one is of a unit while another can have another or being completely unitless)?

$\endgroup$
2
  • $\begingroup$ FWIW it's not true that all three factors are supposed to be from the set of real numbers. They can be quantities with units. (Or potentially even vectors or some such thing that has the right properties to be an integration variable.) $\endgroup$
    – David Z
    Commented Jul 5 at 17:28
  • 1
    $\begingroup$ If $s$ is distance and $t$ is time, you would interpret $v=\frac{ds}{dt}$ as instantaneous velocity with dimension $[\text{Distance}]\cdot [\text{Time}]^{-1}$ and $a=\frac{dv}{dt}=\frac{d^2s}{dt^2}$ as acceleration $[\text{Distance}]\cdot [\text{Time}]^{-2}$. You can do something similar with integrals. $\endgroup$
    – Henry
    Commented Jul 5 at 23:05

4 Answers 4

22
$\begingroup$

No, even if $\mathrm{d}x$ represents an infinitesimal quantity, it must have the same units as $x$. Moreover, as a density, $f(x)$ will display the inverse units of $x$. In consequence, if $[X]$ denotes the units of the variable $X$, then one has : $$ [\Bbb{E}(X)] = [x]\cdot[f(x)]\cdot[\mathrm{d}x] = [X]\cdot[X]^{-1}\cdot[X] = [X] $$ Unsurprisingly, the average value of $X$ possesses the same units as $X$.

$\endgroup$
5
  • 3
    $\begingroup$ Thanks. The unit of the density function is what I've missed. Too often $f(x)$ was thought in percentage - i.e. unitless. $\endgroup$
    – DannyNiu
    Commented Jul 5 at 7:38
  • 2
    $\begingroup$ @DannyNiu Remember that "percent" is amount per 100. Per 100 whats? Oh, per 100 of whatever $x$ is. Hence if you are thinking of $f(x)$ as a percentage, then it has units of $1 / (100[x])$. $\endgroup$
    – Xander Henderson
    Commented Jul 5 at 18:54
  • $\begingroup$ Like I said in my answer , that is not the only way to resolve this issue , @XanderHenderson , there are authors who will use things like "Let $x$ be the length" where $x$ must itself be length units , while there are other authors who will use things like "Let $x$ be the length in meters" where the real number $x$ itself is unitless. With that way , it is then more meaningful to consider $E[x^2+x^3]$ with "Unitless Percentages" , otherwise , we can not add area to volume. $\endgroup$
    – Prem
    Commented Jul 5 at 19:36
  • 3
    $\begingroup$ @XanderHenderson Not to insist on arguing, but for most of the time, I just assume the percentage symbol % has the unitless value of 0.01. It's multiplied with a human-friendly 2-digit number (occasionally 1-digit or 3-digit) to indicate progress or fraction. This way, "%" is generic, and the "amount per 100" can be per 100 whatever the author wishes. $\endgroup$
    – DannyNiu
    Commented Jul 6 at 6:33
  • 7
    $\begingroup$ @XanderHenderson I don't think that explanation is correct. The distinction is between probabilities and probability densities; the point is that $f(x)$ is not a probability (and hence cannot be written in percentages) --- which would indeed be dimensionless --- but is instead a probability density. $\endgroup$
    – YiFan Tey
    Commented Jul 6 at 6:55
3
$\begingroup$

Like everything in mathematics, it depends on the definitions and rules we set. Here, we need to remember that derivatives and integration are limits and it seems reasonable that

If a quantity has U for unit, then its limits has also U for limit. In particular,

  1. If $x_n$ is a convergent sequence with unit U, then $\lim_{n\to\infty}x_n$ has also U for unit
  2. If $y=g(x)$ is a function with unit U (on the output), then $\lim_{x\to a} g(x)$ has also limit U (when the limit exists).

Together with the other, universally-accepted rules for units

  1. If $a$ and $b$ have the same unit U, then $a+b$ and $a-b$ have also U for unit.
  2. If $a$ has U for unit and $b$ has V for unit, then $ab$ have UV for unit
  3. If $a$ has U for unit and $b$ has V for unit, then $\frac{a}{b}$ have U/V for unit.

we get that if $f(x)$ is a function where the input $x$ has unit V and the output $f(x)$ has unit U, then $\frac{f(x)-f(a)}{x-a}$, hence the derivative $f'(a)=\lim_{x\to a}\frac{f(x)-f(a)}{x-a}$, has unit U/V

On the other hand, the Riemann sum $S_n=\sum_{k=1}^nf(x_k^\ast)\Delta$, hence the definite integral $\int_a^b f(x)\ dx=\lim_{n\to\infty}S_n$, has unit UV.

$\endgroup$
0
$\begingroup$

In the case you've explicitly asked about,

$$ \int x f(x) \, dx $$

The answer is probably no: $dx$ has the same units as $x$, and if $x$ has units, then $dx$ has units. The reason I say probably is that if $x$ is unitless, then $dx$ is similarly unitless.

In the more general case which your title text may reference:

$$ \int x(z) \, f(y(z)) \,dz $$

The clear answer is a resounding yes. In physics, they often integrate over states which would give $dz$ units of count (which is unit-less) even though the integral as a whole may have meaningful units like temperature or pressure.

$\endgroup$
-1
$\begingroup$

Interesting View-Point , though there are certain logical issues like what you encountered.

"Can the differential be unitless while the variable have an unit in integration?" : No

We have $\Delta x$ tracking the small change in $x$. That lets us calculate $x + \Delta x$
When volume $v$ in $m^3$ varies , the small change $\Delta v$ must be in $m^3$ , which will let us calculate $v + \Delta v$ in $m^3$
When time $t$ in $s$ varies , the small change must be in $s$ , which will let us calculate $t + \Delta t$ in $s$

In Case the units do not match , such calculations will be meaningless : We can not add a number with units to a number without units.

We can avoid that issue with 2 ways.

(1) Both have same units :

$x$ & $\Delta x$ have the same units like $m^3$ , $s$ , $\cdots$
That will let us add $x$ & $\Delta x$
While certain things will work out , it will complicate calculations like Series $1+x+x^2+x^3\cdots=1/(1-x)$
That complication can be resolved , though more work is required.
Basically , we have to ensure that there are certain co-efficients like $a_1x+x_2x^2+a_2x^3\cdots$ where these co-efficients (which should have the necessary units) will convert all the terms to some common unit , letting us add the terms.

Your Integral can use the same thinking :
In your Integral , $x$ & $\Delta x$ will have same units , while the "Density" function must be in reciprocal units.
Hence , the over-all units will be consistent : $E(x)$ & $x$ will have same units.

(2) Both are unitless :

Alternate way is to take all variables to not have units. When we want to calculate area or volume or what-ever , we remove that units from the variables , then we make the calculations , then we add the units back.
There are no complication with calculations like Series $1+x+x^2+x^3\cdots=1/(1-x)$

Your Integral can use the same thinking :
All terms $x$ , $\Delta x$ , $f(x)$ have no units.
Make the calculations , then introduce the relevant units when required.
This way lets us talk about arbitrary terms like $E(x+x^2)$ , $E(x+1/x)$ , $E(\sqrt{x}+e^x)$ , for example , without losing consistency.

Both ways are common & used where-ever appropriate.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .