How to get nth derivative of $e^{x^2/2}$ 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)$.
 A: As noted before this is a variant of the Hermite polynomials. Due to subtle differences, we will adapt the standard derivation from Arfken.
Generating function
First
\begin{align}
\frac{d^n}{dx^n} e^{x^2/2}
&=
\lim_{t\rightarrow 0} \frac{d^n}{dx^n} e^{(x+t)^2/2}
\tag{1} \\
&=
\lim_{t\rightarrow 0} \frac{d^n}{dt^n} e^{(x+t)^2/2} \\
&=
e^{x^2/2} \lim_{t\rightarrow 0} \frac{d^n}{dt^n} e^{xt + t^2/2},
\end{align}
This means that the polynomials $P_n(x)$ we are looking for
are just the $n$th coefficients of the Taylor expansion of
$e^{xt+t^2/2}$. In other words,
\begin{align}
e^{xt + t^2/2} = \sum_{n = 0}^\infty \frac{P_n(x)}{n!} t^n.
\tag{2}
\end{align}
The left-hand side is the exponential generating function of $P_n(x)$.
Recurrence relations
If we differentiate (2) with respect to $t$,
$$
(x + t) \, e^{xt + t^2/2} = \sum_{n = 1}^\infty \frac{P_n(x)}{(n-1)!} t^{n-1}
 = \sum_{n = 0}^\infty \frac{P_{n+1}(x)}{n!} t^n.
\tag{3}
$$
where the previous n = 0 term is simply equal to zero, allowing for a shift in indices.
Expanding the left-hand side,
\begin{align}
(x + t) \, e^{xt + t^2/2}
&=
(x + t) \sum_{n = 0}^\infty \frac{ P_n(x) }{n!} t^n
\\
&=
\sum_{n = 0}^\infty \frac{ x \, P_n(x) }{n!} t^n
+
\sum_{n = 0}^\infty \frac{ P_n(x) }{n!} t^{n+1}
\\
&=
\sum_{n = 0}^\infty \frac{ x \, P_n(x) }{n!} t^n
+
\sum_{n = 1}^\infty \frac{ n \, P_{n-1}(x) }{n!} t^{n}.
\tag{4}
\end{align}
Comparing the coefficients of $t^n/n!$ in (3) and (4) yields
$$
P_{n+1}(x) = x \, P_n(x) + n P_{n-1}(x).
\tag{5}
$$
Similarly, by differentiating (2) with respect to $x$, we get
$$
P'_n(x) = n P_{n-1}(x),
\tag{6}
$$
which is noted by Barry Cipra.
Combining the two yields the relation by hermes.
Explicit formula
An explicit formula is more readily derived from the generating function instead of the recurrence relations:
\begin{align}
e^{xt+t^2/2}
&= e^{xt} \, e^{t^2/2}\\
&= \sum_{s = 0}^\infty \frac{(xt)^s}{s!} \sum_{m = 0}^\infty \frac{t^{2m}}{2^m \, m!} \\
&= \sum_{n = 0}^\infty
\left(
\sum_{m = 0}^{[n/2]} \frac{ n! \, x^{n-2m} }{ 2^m \, m! \, (n-2m)! }
\right) \frac{t^n}{n!},
\end{align}
where $[n/2]$ denotes the largest integer not exceeding $n/2$.
Comparing this to (2), we get
\begin{align}
P_n(x) = \sum_{m = 0}^{[n/2]} \frac{ n! \, x^{n-2m} }{ 2^m \, m! \, (n-2m)! }.
\end{align}
Relations to the standard definitions
For reference, $P_n(x)$ is related to the standard Hermite polynomials as
\begin{align}
P_n(x)
&= (-i)^n \, \mathrm{He}_n(ix) \\
&= \frac{1}{(\sqrt{2} \, i)^n} \, H_n\left(\frac{ix}{\sqrt{2}}\right).
\end{align}
Notes
I recently discovered that the problem is related to Find an expression for the $n$-th derivative of $f(x)=e^{x^2}$, and the above solution is essentially the same as this one.
A: Try proving (by induction) that
$$P_{n+1}=xP_n+nP_{n-1}$$
(Note, this is equivalent to proving that $P_n'=nP_{n-1}$.)
A: Here is another method which will work. You have shown by a simple argument that 
$${P_i}(x) = {P'_{i - 1}}(x) + x{P_{i - 1}}(x),\,\,\,\,\,\,\,\,\,\,{P_0}(x) = 1,\,\,\,\,\,\,\,\,\,\,i = 1,2,...,n\tag{1}$$
Now let's take a look at the derivatives of $f(x)$ directly
$$\eqalign{
  & {f^{(0)}}(x) = {e^{{{{x^2}} \over 2}}}  \cr 
  & {f^{(1)}}(x) = x{e^{{{{x^2}} \over 2}}}  \cr 
  & {f^{(2)}}(x) = \left( {1 + {x^2}} \right){e^{{{{x^2}} \over 2}}}  \cr 
  & {f^{(3)}}(x) = \left( {3x + {x^3}} \right){e^{{{{x^2}} \over 2}}}  \cr 
  & .  \cr 
  & .  \cr 
  & .  \cr 
  & {f^{(n)}}(x) = {P_n}(x){e^{{{{x^2}} \over 2}}} \cr} \tag{2}$$
The first few terms suggest the formula ${{P'}_i}(x) = i{P_{i - 1}}(x)$ to be true. We may prove this easily by using $(1)$ and induction. According to $(2)$, it is clear that the formula is true for $i=1$. Now suppose it is true for $i=k$, ${{P'}_k}(x) = k{P_{k - 1}}(x)$, and then we shall prove it is also true for $i=k+1$. For this purpose, consider the following
$$\eqalign{
  & {P_{k + 1}}(x) = {{P'}_k}(x) + x{P_k}(x) = k{P_{k - 1}}(x) + x{P_k}(x)  \cr 
  & {{P'}_{k + 1}}(x) = k{{P'}_{k - 1}}(x) + {\left( {x{P_k}(x)} \right)^\prime }  \cr 
  & \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, = k{{P'}_{k - 1}}(x) + {P_k}(x) + x{{P'}_k}(x)  \cr 
  & \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, = k{{P'}_{k - 1}}(x) + {P_k}(x) + kx{P_{k - 1}}(x)  \cr 
  & \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, = k\left( {{{P'}_{k - 1}}(x) + x{P_{k - 1}}(x)} \right) + {P_k}(x)  \cr 
  & \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, = k{P_k}(x) + {P_k}(x)  \cr 
  & \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, = \left( {k + 1} \right){P_k}(x) \cr}\tag{3} $$
Now combining this new result with $(1)$ we can conclude
$${P_i}(x) =   x{P_{i - 1}}(x) + i{P_{i - 2}}(x),\,\,\,\,\,{P_0}(x) = 1,\,\,\,{P_1}(x)=x,\,\,\,\,\,i = 2,3,...,n\tag{4}$$
Finally, you can use $(4)$ as a recursive relation to derive $P_n(x)$ by a usual systematic procedure. That's all.
A: You could try $P_n(x)=\Sigma^n_{i=0} a_{n,i}x^i$
Then your equation $(1)$ becomes $\Sigma^n_{i=0} a_{n,i}x^i=x\Sigma^{n-1}_{i=0} a_{n-1,i}x^i+\Sigma^n_{i=0} ia_{n-1,i}x^{i-1}$
Comparing coefficients of $x^i$ gives $a_{n,i}=a_{n-1,i-1}+ia_{n-1,i+1}$
Does that help?
A: 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.
