TITLE: How to get nth derivative of $e^{x^2/2}$
QUESTION [7 upvotes]: I want to calculate the nth derivative of $e^{x^2/2}$. It is as follow:
$$ 
\frac{d}{dx} e^{x^2/2} = x e^{x^2/2} = P_1(x) e^{x^2/2}
$$
$$ 
\frac{d^n}{dx^n} e^{x^2/2} = \frac{d}{dx} (P_{n-1}(x) e^{x^2/2}) = (x P_{n-1}(x) + \frac{dP_{n-1}}{dx})e^{x^2/2} = P_n(x) e^{x^2/2}
$$
So we get recursive relation of $P_n$:
$$ P_n(x) = xP_{n-1} + \frac{dP_{n-1}}{dx}, P_0(x) = 1\tag1
$$
My question is how to solve the recursive relation involving function and derivative. I know generating function for recursion like $a_{n+1}=a_{n}+a_{n-1}$. But I am not sure how to solve $(1)$.

REPLY [2 votes]: We have the multiplicative rule for differentiation: $$\frac{\partial fg}{\partial x} = \frac{\partial f}{\partial x} g + f \frac{\partial g }{\partial x}$$
Also the "chain rule" or rule for function composition: $$\frac{\partial (g(h))}{\partial x} = \frac{\partial g}{\partial h}\frac{\partial h}{\partial x}$$
So we let $g = \exp(h)$, $h = x^2/2$. We see that $\frac{\partial h}{\partial x} = x$ and $\frac{\partial g}{\partial h} = g$
Now we let $f$ be a polynomial. Differentiating a polynomial and expressing the result is a simple linear thing to do. Each exponent is reduced by one and coefficient multiplied by the old exponent so we can write this as a matrix with the numbers $1,2,3$ in one of the superdiagonals. But multiplication with $x$ is also a matrix operation on the coefficients of a polynomial. So we can rewrite each differentiation as a matrix-vector product and then investigate it's properties in terms of matrix properties and linear algebra.