Question
Supppose $X$ is a random PDF $f(x)=\frac{2x}{c^{2}d^{2}}, \quad 0<x<cd$ where $c > 0, \; d > 0$.
Determine the values of $c$ and $d$ so that $\mathbb{E}[X]= c $ and $\mathrm{Var}(x) = 1$
My approach
My approach has been to try and isolate the variables using the given information. I have used $\mathrm{Var}(X) = 1$ as a reference point to start. My work has been as follows:
\begin{align} 1 &= \mathbb{E}(X^2) - \mathbb{E}[X]^2 \\ 1 &= \int_{0}^{cd} x^{2} \cdot \frac{2x}{c^{2}d^{2}} - \left(\int_{0}^{cd} x \cdot \frac{2x}{c^{2}d^{2}}\right)^2 \end{align}
Following this, I have approached this result: \begin{align} 1 = \frac{(cd)^4}{2c^2d^2} - \frac{(cd)^4}{c^4d^4} \end{align}
Which yields the following: \begin{align} 1 &= \frac{c^2d^2}{2} \\ 2 &= c^2d^2 \\ \end{align}
I have then derived the possible inter solutions of $c$ and $d$.
\begin{align*} \therefore c &= \pm 1\; ,\pm 2 \\ d &= \pm 1\; , \pm 2 \end{align*}
I have then tried to prove the $\mathbb{E}[X] = c$ through the following case. Suppose $c = 1$ and $d = 2$ thus $0 < x < 2$.
\begin{align} \mathbb{E}[X] &= \int_{0}^{2} x\cdot \frac{2y}{c^{2}d^{2}} \; \mathrm{d}y \\ &= \int_{0}^{2} \frac{2x^2}{4} \; \mathrm{d}x \\ &= \frac{1}{4}\int_{0}^{2} 2x^2 \; \mathrm{d}x \\ &= \frac{1}{4} \cdot \frac{2x^3}{3} \Biggr|_{0}^{2} \end{align}
However, the answer does not evalute to the case. I have taken the wrong approach and am lost on how to approach the problem. Any help with the solution would be really appreciated.
Update
Thank you for the suggestions. Errors were made in the integration. The error was found within the 2nd integral.
$$ \frac{(cd)^4}{c^4d^4} \rightarrow \frac{2(cd)^3}{3(c^4d^4)} $$
Squaring the results would give the following $\frac{4c^2d^2}{9}$
The derivation of the expected value for $c$ is as follows
\begin{align} c &= \int_{0}^{ac} x \cdot \frac{2x}{c^2d^2} \; \mathrm{d}x \\ c &= \frac{2}{c^2d^2} \int_{0}^{cd} x^2 \\ c &= \frac{2}{c^2d^2} \cdot \frac{x^3}{3} \Biggr|_{0}^{cd} \\ c &= \frac{2x^3}{3c^2d^2} \xrightarrow[]{} \frac{2(cd)^3}{3c^2d^2} \\ c &= \frac{2}{3}cd \\ &\therefore d = \frac{3}{2} \end{align}
Following that, the answer would be simply substituting it into the corrected equation for variance.
\begin{align} 1 &= \frac{1}{2}c^2\cdot \frac{9}{4} - \frac{4}{9}c^2\cdot\frac{9}{4} \\ 1 &= \frac{9}{4}c^2\left(\frac{1}{2}-\frac{4}{9}\right) \\ 18 &= \frac{9}{4}c^2 \\ 8 &= c^2 \\ c &= 2\sqrt{2} \end{align}.
Here's a quick way to solve this. Brief hints are provided for the path to follow. Reveal the spoilers if you get stuck in computations.
You have $\mathbb E[X]=c$. Then put this into the Variance equation.
For the expectation, you have
Plugging this in, we get
and you are done.