How to solve the Schrödinger equation with magnetic field? The Schrödinger equation of electron in a magnetic field is
$$
\frac{1}{2m} \left(-\mathrm{i}\hbar\nabla+\frac{e}{c}\mathbf{A}\right)^2 \psi + V\psi = E\psi
$$
where $V=-e\phi$ and $\phi$ is the scalar potential.
And the solution is
$$
\psi(\mathbf{r}) = \psi_0(\mathbf{r}) \exp\left[-\frac{\mathrm{i}e}{\hbar c} \int^{\mathbf{r}}_{\mathbf{r}_0} \mathbf{A}(\mathbf{r}') \cdot \mathrm{d}\mathbf{r}'\right].
$$
It's easy to check this solution by putting into the previous equation. But how can I achieve the solution directly from Schrödinger equation?
 A: If $A$ is not a pure gauge, or more weakly if $\nabla \times A \neq 0$, then it is false that $$\nabla_r \int_{r_0}^r A(r')\cdot dr' = A(r)\tag{0}$$ Without this result, by direct inspection you see that your statement is false. Otherwise it is  true. The proof is easy, it is the direct generalization of this elementary identity
$$\left(-i\frac{d}{dx} + f(x)\right)  \psi(x) =-ie^{+i \int^x_0 f(y) dy} \frac{d}{dx} e^{-i \int^x_0 f(y) dy}\psi(x) \tag{1}\:.$$
From (1), implementing once more the identity you have
$$\left(-i\frac{d}{dx} + f(x)\right) \left(-i\frac{d}{dx} + f(x)\right)  \psi(x) =(-i)^2e^{+i \int^x_0 f(y) dy} \frac{d}{dx} e^{-i \int^x_0 f(y) dy} e^{+i \int^x_0 f(y) dy} \frac{d}{dx} e^{-i \int^x_0 f(y) dy}\psi(x)\:,$$
that is
$$\left(-i\frac{d}{dx} + f(x)\right)^2 \psi(x)=  e^{+i \int^x_0 f(y) dy} \frac{d^2}{dx^2} e^{-i \int^x_0 f(y) dy}\psi(x)$$
and finally
$$ e^{-i \int^x_0 f(y) dy} \left[\left(-i\frac{d}{dx} + f(x)\right)^2 + U(x)\right]\psi= \left(-\frac{d^2}{dx^2} +U(x) \right)e^{-i \int^x_0 f(y) dy}\psi(x)\:.$$
The crucial point in the computations above is that 
$$\frac{d}{dx}\int_0^x f(y) dy = f(x).\tag{2}$$
Unfortunately, the procedure does not work in dimension $>1$, since the generalization of $\int^x_0 f(y) dy$ depends on the integration path unless the vector field $A$ which replaces $f$ has zero curl. Also  fixing arbitrarily a path, the generalisation (0) of (2) generally does not hold in dimension greater than $1$.
Validity of (2) for dimension greater than $1$ is equivalent to saying that $A$ is a pure gauge at least locally, and however $B = \nabla \times A =0$.
