This **article aims to find the mean and variance** of $ x$ given $ f(x) $ and the range of $x$. The article uses the **concept of mean and variance**.

The **formula for mean and variance** is given as:

\[mean \: of \: x = E(x) = \int_{-\infty}^{\infty} xf(x)dx \]

\[Variance\: of\: x = Var(x) = E[x^{2}] – (E[x])^{2}\]

**Expert Answer**

To get the **mean and variance** of $ x $, we first need to verify that…

– $x$ is a **discrete or continuous random variable**

– $f$ is the **probability weight or probability density function**

because if we can’t verify the above $2$ statements, then we can’t calculate the **mean and variance.**

Since $0 < x < 4$, $x$ is a** continuous random variable** because $x$ can be any **positive number less than that includes a non-integer**.

Note that if the **random variable is continuous** and $0\leq f(x) \leq 1$ for any values of $x$ in the domain $f$, then $f$ is a **probability density function** $(PDF)$.

Note that:

\[0<x<4\]

\[\Leftrightarrow 0.125(0) < 0.125x < 0.125(4) \]

\[\Leftrightarrow 0 < 0.125x < 0.5 \]

\[\Leftrightarrow 0 < f(x) < 0.5 \]

\[\Rightarrow 0<f(x) <1 \]

Thus, for any $x$ in the domain $f$, $0 < f(x) < 1$. Furthermore, since $x$ is a **continuous random variable**, $f$ is a $PDF$.

First, we use the following notation for** mean and variance:**

\[E(x) = mean \: of \: x\]

\[Var(x) = variance\: of \: x\]

Since $f$ represents **probability density function**, we can use the following formulas for the **mean and variance** of $x$:

\[mean \: of \: x = E(x) = \int_{-\infty}^{\infty} xf(x)dx \]

\[Variance\: of\: x = Var(x) = E[x^{2}] – (E[x])^{2}\]

To find the **mean** of $ x$:

\[mean\: of \: x = E[x] \]

\[= \int_{-\infty}^{\infty} xf(x)dx\]

\[mean\: of \: x= \int_{-\infty}^{\infty} 0.125x^{2}dx \]

The** integral seems complicated because of the infinity sign**, but since the domain of $f$ is the **set of positive numbers smaller** than $4$, i.e.

\[domain\: of \: f = {x: 0<x<4}\]

The **bounds of the integral for mean value can be changed** from $-\infty <x < \infty$ to $0<x<4$ such that:

\[mean\: of \: x = \int_{-\infty}^{\infty} 0.125x^{2}dx = \int_{0}^{4} 0.125 x^{2} dx\]

Hence, the** mean is computed** as:

\[= |\dfrac{0.125 x^{3}}{3}|_{0}^{4} = \dfrac{8}{3}\]

\[mean \: of \: x = 2.667\]

The formula for the variance of the $ x$ is

\[Variance\: of\: x = Var(x) = E[x^{2}] – (E[x])^{2}\]

We **need to compute** $E[x^{2}]$

\[E[x^{2}] = \int_{-\infty}^{\infty} x^{2} f(x)dx \]

\[=\int_{-\infty}^{\infty} x^{2} (0.125x) dx \]

\[=\int_{-\infty}^{\infty} 0.125x^{3} dx \]

\[E[x^{2}]=\int_{-\infty}^{\infty} 0.125x^{3} dx =\int_{0}^{4} 0.125x^{3} dx \]

\[= |\dfrac {0.125x^{4}}{4}|_{0}^{4}\]

\[E[x^{2}] = 8\]

\[Variance\: of\: x = Var(x) = E[x^{2}] – (E[x])^{2}\]

\[variance \: of \: x = 8- (\dfrac{8}{3})^{2} \]

\[variance \: of \: x = 0.889\]

**Numerical Result**

–**The mean of $x$ is $2.667$.**

–**The variance of $x$ is $0.889$.**

**Example**

**Suppose $f(x) = 0.125x$ for $0 < x < 2$. Determine the mean and variance of $x$.**

**Solution**

\[mean \: of \: x = E(x) = \int_{-\infty}^{\infty} xf(x)dx \]

\[Variance\: of\: x = Var(x) = E[x^{2}] – (E[x])^{2}\]

Hence, the** mean is computed** as:

\[mean \: of \: x = 0.33\]

The** formula for the variance** of the $ x$ is:

\[variance \: of \: x = 0.3911\]