Hi forum, any help appreciated!

Notation$\displaystyle CDF_x(x)$ is the cumulative distribution of x

$\displaystyle PDF_x(x)$ is the probability density of x

Problem

Let X be a random variable with a uniform distribution on (-1,1)

Let $\displaystyle Y=g(x) = ax^3 + (1-a)x$ [a is a constant between 0 and 1]

Find the pdf of Y.

My attempt (ive highlighted in red where i assume my mistake is)i will use these results later:

$\displaystyle CDF_x(x) = 0.5x + 0.5$

$\displaystyle g'(x) = 3ax^2 + 1-a$

Now try to find $\displaystyle CDF_y(y)$ and then differentiate to get $\displaystyle PDF_y(y)$

$\displaystyle CDF_y(y) = P(Y<y) = P\left( g(x) < y \right)$

(apply inverse of g to both sides of inequality)

$\displaystyle CDF_y(y) = P(Y<y) = P\left( g^{-1}\left(g(x)\right) < g^{-1}(y) \right)$

(simplify)

$\displaystyle CDF_y(y) = P(Y<y) = P\left( x < g^{-1}(y) \right)$

(the RHS is by definition the CDF of x)

$\displaystyle CDF_y(y) = P(Y<y) = CDF_x\left(g^{-1}(y) \right)$

(we know the functional form of the CDF of x is 0.5x+0.5, substitute)

$\displaystyle CDF_y(y) = 0.5 \times g^{-1}(y) + 0.5$

Now we can differentiate (this is where i a assume my mistake is)

use the rule that the derivative of $\displaystyle g^{-1}$ is the reciprocal of the derivative of g.

$\displaystyle PDF_y(y) = \frac{d(CDF_y(y)}{dy} = \frac{d\left(0.5g^{-1}(y) + 0.5 \right)}{dy} = \frac{0.5}{g'(y)} + 0$

now, substitute the actual $\displaystyle g'(y) = ay^3 + (1-a)y$

$\displaystyle PDF_y(y) = \frac{0.5}{g'(y)} = \frac{0.5}{3ay^2 + 1-a} $

ive done some monte carlo simulations and im pretty sure my CDF(y) is correct but my PDF(y) isn't .... can anyone help?