Is it possible to find an expression for $\frac{d^n}{dx^n}e^{-x^2}$? I am trying to find a general form to derivatives of the function $e^{-x^2}$. I tried to do it by finding a pattern for the first derivatives but with no success. 
Any tip is welcome.
 A: These are called Hermite polynomials, in one form or another. Let me show you show to "discover them".
Let $p_n$ be your $n$th derivative and $f=p_0$. To simplify matters I will instead consider $f= e^{x^2/2}$ (you can roll back by replacing $x$ by $\sqrt{2}xi$). Then $p_1 = x p_0$. Assume by induction that $p_n$ is of the form $q_n p_0$ for some polynomial $q_n$. Then you get that the same holds for $p_{n+1}$, since then:
$$p_{n+1} = q_n'p_0 + xq_n p_0$$
This gives you a recurrence $q_{n+1} = q_n' +x q_n$. Note that $q_0=1$ and $q_1=x$, and in fact $q_n$ is obtained by iterating the operator $\partial +x$ on $1$, that is
$$q_n = (\partial+x)^n q_0.$$
One would be tempted to use the binomial theorem here, but $\partial=d/dx$ and $x$ do not commute (!), in fact we have that for any polynomial $p$:
$\partial(xp)- x(\partial p) = p+xp'-xp' = p$
i.e. $\partial x-x \partial$ acts as the identity: we have discovered the defining relation of the Weyl algebra. This allows you to organize your computation into something that looks like a sum of terms $x^n \partial^k$ as in the binomial theorem, but now something curious happens:
applying the rule that $ \partial x=x \partial+1$ many times you get that
$$\partial^Nx = x \partial^N+N \partial^{N-1}.$$
And here comes the last (not so fun) part that you can prove by induction on $n$: it turns out that
$$(x+\partial)^n = \text{usual binomial sum} + \sum_{2a+b+c=n} \frac{n!}{a!b!c!} 2^{-a}x^b\partial ^c$$
where we only require that $c>0$. This tells us how to write down $(x+\partial)^n$ in terms of the simpler operators $x^n\partial^m$, and we know
how these act on $1$. So, for example, from
$$(x+\partial)^2  = x^2+2x\partial +\partial^2  \underline{+1}$$
you get $q_2 = x^2+1$. From
$$q_3 =  (x+\partial)^3 = x^3+3x^2\partial^2+3x\partial^2+\partial^3 \underline{+ 3x+ 3\partial}$$
you get $q_3 = x^3+3x$.
And now we can finish the computation of $q_n$: since $q_0= 1$ and since $\partial(1)=0$, we only need to consider terms in the sum above where there is no $\partial$ appearing (i.e. only take $x^n$ in the binomial sum and take only the terms with $c=0$ in the second one. This gives
$$q_n =  x^n+ \sum_{2a+b=n} \frac{(2a+b)!}{a!b!}  2^{-a}x^b.$$
You can obtain a version of the standard Hermite polynomials by changing $x$ to $2x$, so that the leading term is $2^n$ and this reads instead
$$r_n =  2^nx^n+ \sum_{2a+b=n} \frac{(2a+b)!}{a!b!}  2^{a+b}x^b.$$
The takeaway you can get here is that understanding a simple relation such as
$$\partial x-x\partial  =1$$
can give you a nice description of a concrete problem. In this case what we have done is more or less pin down how the first Weyl algebra acts on the vector space of polynomials in one variable.
A reference for the discrepancy between $(x+\partial)^n$ and the usual binomial sum in the Weyl algebra is this paper.
A: Set $u(x)=e^{x}$, $v(x)=-x^2$ and use the famous Faà di Bruno's Formula. 
$$
\frac{d^{n}}{d x^{n}} u(v(x))=
\sum_{m_1+m_2+\ldots+m_n=n}
\frac{n !}{m_{1} ! m_{2} ! \cdots m_{n} !} 
\cdot 
u^{\left(m_{1}+\cdots+m_{n}\right)}(v(x)) 
\cdot 
\prod_{j=1}^{n}\left(\frac{v^{(j)}(x)}{j !}\right)^{m_{j}}
$$
For $n=2$ we have
\begin{align}
\frac{d^{2}}{d x^{2}} u(v(x))
=&
\sum_{m_1+m_2=2}
\frac{2!}{m_{1} ! m_{2}!} 
\cdot 
u^{\left(m_{1}+m_{2}\right)}
\cdot 
(v(x)) 
\cdot 
\prod_{j=1}^{2}
\left(\frac{v^{(j)}(x)}{j !}\right)^{m_{j}}
\\
=&
\sum_{m_1+m_2=2}
\frac{2!}{m_{1} ! m_{2}!} 
\cdot 
u^{\left(m_{1}+m_{2}\right)}
\cdot 
(v(x)) 
\cdot 
\left(\frac{v^{(1)}(x)}{1 !}\right)^{m_{1}}
\cdot
\left(\frac{v^{(2)}(x)}{2 !}\right)^{m_{2}}
\end{align}
The partitions of $m_1+m_2=2$ are $(m_1,m_2)=(2,0),(1,1),(0,2)$. Then
\begin{align}
\frac{d^{2}}{d x^{2}} u(v(x))
=&
\frac{2!}{2 ! 0!} 
\cdot 
u^{\left(2+0\right)}
\cdot 
(v(x)) 
\cdot 
\left(\frac{v^{(1)}(x)}{1 !}\right)^{2}
\cdot
\left(\frac{v^{(2)}(x)}{2 !}\right)^{0}
\\
+&
\frac{2!}{1 ! 1!} 
\cdot 
u^{\left(1+1\right)}
\cdot 
(v(x)) 
\cdot 
\left(\frac{v^{(1)}(x)}{1 !}\right)^{1}
\cdot
\left(\frac{v^{(2)}(x)}{2 !}\right)^{1}
\\
+&
\frac{2!}{0 ! 2!} 
\cdot 
u^{\left(0+2\right)}
\cdot 
(v(x)) 
\cdot 
\left(\frac{v^{(1)}(x)}{1 !}\right)^{0}
\cdot
\left(\frac{v^{(2)}(x)}{2 !}\right)^{2}
\end{align}
A most interessant formulation is 
Faà di Bruno's determinant formula. If $u$ and $v$ are functions with a sufficient ber of derivatives, and $m \geq 1,$ then
$$
\frac{d^{m}}{d x^{m}} u(v(x))
=
\det
\left(
\begin{array}{cccccc}
\left(\begin{array}{c}
m-1 \\
0
\end{array}\right) u^{\prime} v & \left(\begin{array}{c}
m-1 \\
1
\end{array}\right) u^{\prime \prime} v & \left(\begin{array}{c}
m-1 \\
2
\end{array}\right) u^{\prime \prime \prime} v & \cdots & \left(\begin{array}{c}
m-1 \\
m-2
\end{array}\right) u^{(m-1)} v & \left(\begin{array}{c}
m-1 \\
m-1
\end{array}\right) u^{(m)} v \\
-1 & \left(\begin{array}{c}
m-2 \\
0
\end{array}\right) u^{\prime} v & \left(\begin{array}{c}
m-2 \\
1
\end{array}\right) u^{\prime \prime} v & \cdots & \left(\begin{array}{c}
m-2 \\
m-3
\end{array}\right) u^{(m-2)} v & \left(\begin{array}{c}
m-2 \\
m-2
\end{array}\right) u^{(m-1)} v \\
0 & -1 & \left(\begin{array}{cc}
m-3 \\
0
\end{array}\right) u^{\prime} v & \cdots & \left(\begin{array}{c}
m-3 \\
m-4
\end{array}\right) u^{(m-3)} v & \left(\begin{array}{c}
m-3 \\
m-3
\end{array}\right) u^{(m-2)} v \\
\vdots & \vdots & \vdots & & \vdots & \vdots \\
0 & 0 & 0 & \cdots & \left(\begin{array}{c}
1 \\
0
\end{array}\right) u^{\prime} v & \left(\begin{array}{c}
1 \\
1
\end{array}\right) v^{\prime \prime} v \\
0 & 0 & 0 & \cdots & -1 & \left(\begin{array}{c}
0 \\
0
\end{array}\right) u^{\prime} v
\end{array}
\right)
$$
where $u^{(i)}$ denotes $u^{(i)}(x)$ and $v^{k}$ is to be interpreted as $v^{(k)}(u(x))$
A: Expanding on @AnginaSeng's comment, define $f_n:=e^{x^2}\frac{d^n}{dx^n}e^{-x^2}$ so $f_0(x)=1$ and$$f_{n+1}(x)=e^{x^2}\frac{d}{dx}\left(e^{-x^2}f_n\right)=-2xf_n(x)+f_n^\prime(x).$$In physicists' notation, $f_n(x)=(-1)^nH_n(x)$. By induction, $\deg H_n=n$.
