Here is the situation: say $f(u)=y=u^2$, and $g(x)=u=x^2$ and we want to find $\frac{d^2y}{dx^2}$.
I have two ways of solving this:
- Substituting $u=x^2$ and writing $y$ as, $$y=(x^2)^2=x^4$$ $$\frac{dy}{dx}=4x^3 \implies\frac{d^2y}{dx^2}=12x^2 $$
Or
- Straight away differentiating $y$ with respect to $x$ $$\frac{dy}{dx}=2u\frac{du}{dx} \implies\frac{d^2y}{dx^2}=2\left[u\frac{d^2u}{dx^2}+\frac{du}{dx}\left(\frac{du}{dx}\right)\right]\text{[Using Chain rule]}$$
\begin{align} \frac{d^2y}{dx^2} & = 2\left[u\frac{d^2u}{dx^2}+\frac{du}{dx}\left(\frac{du}{dx}\right)\right] \\ & = 2\left[x^2(2)+2x(2x)\right]\\ &= 2[2x^2+4x^2]\\ &=2[6x^2]\\ &=12x^2 \end{align}
Are both of these ways correct to solve this question?
Yes, both methods used for finding the second derivative $\frac{d^2y}{dx^2}$ are correct and lead to the same result.
The first method is a straightforward application of the power rule. It substitutes $u$ with $x^2$ directly in $y$, and then takes the derivative with respect to $x$.
The second method applies the chain rule for differentiation. It first finds the derivative of $y$ with respect to $u$ and then multiplies it by the derivative of $u$ with respect to $x$.
Both approaches works here, leading to the same result $12x^2$ you found.
Hope this helps!