Gaussian beam propagation with ABCD matrix through a grin lens I am currently trying to simulate a Gaussian beam that has a transverse offset of around 20um from the optic axis where the Gaussian beam travels through a grin lens using the ABCD matrix method. I have correctly simulated the case when the guassian beam is inline with the optic axis but do not know how to take into account of the offset in the second case where the guassian beam is offset by 20um from the optic axis. I have attached an image to clarify my question.

Thanks
 A: Diffractive optics in the Fresnel approximation is exactly the same as quantum mechanics of a particle with $\hbar$ replaced by the inverse angular frequency $\omega^{-1}$ of the light and time replaced by thickness along the optical axis.
Let the coordinate on the reference plane on the object side of the optical system be $x$. Treating the electric field of the light on this plane as a scalar field, the amplitude is $\langle x|\psi\rangle$. For a Gaussian beam on axis,
\begin{equation}
\langle x|\psi\rangle=\frac{\exp{\left(\frac{i}{2}\frac{x^{2}}{(q/n)}\right)}}{i(q/n)}
\end{equation}
where $n$ is the refractive index, $q=t-id_{0}$ is the complex beam parameter. $t$ is the thickness from the waist of the beam and $d_{0}$ is the confocal beam parameter. This formula uses natural units in which the speed of light $c=1$ and $\omega^{-1}=1$ in order to avoid writing the messy conversion factors. 
The question needs the input beam displaced by distance $a$ (say) from the optical axis. The input amplitude is now,
\begin{equation}
\langle x|\psi\rangle=\frac{\exp{\left(\frac{i}{2}\frac{(x-a)^{2}}{(q/n)}\right)}}{i(q/n)}
\end{equation}
Let the coordinate on the reference plane on the image side of the optical system be $x'$. For a lossless optical system, we just need the unitary operator $\hat{U}$ that maps the input field $|\psi\rangle$ to the output field $\hat{U}|\psi\rangle$.This operator is determined by the ray matrix of the optical system. I use the ray matrix convention in the book "The Ray and Wave Theory of Lenses" by A. Walther.
\begin{equation}
\left[
    \begin{array}{c}
         p' \\
         x'
    \end{array}
  \right]=
  \left[
    \begin{array}{cc}
      B & -A \\
      -D & C
    \end{array}
  \right]
  \left[
    \begin{array}{c}
      p \\
      x
    \end{array}
  \right] \ .
\end{equation}
The variables $p.p'$ are the momentum variables canonically conjugate to the position coords $x,x'$. Returning to SI units for a while, the canonically conjugate momentum is,
\begin{equation}
p=\frac{n}{c}\frac{dx}{ds}=\frac{n}{c}\sin{\theta}
\end{equation}
where $s$ is arc length along a ray. In natural units in $c=1$ the momentum variable is $p=n\sin{\theta}$ and so the entries in the ray matrix have their usual meaning. The formula (in natural units) for the unitary operator for a general optical system in position basis is,
\begin{equation}
\langle x'|\hat{U}|x\rangle=\frac{1}{\sqrt{i^{-1}D}}\exp{\left(-(i/2)(x'BD^{-1}x'-2x'D^{-1}x+xD^{-1}Cx)\right)}
\end{equation} 
The output field in position basis is now,
\begin{equation}
\langle x'|\psi'\rangle=\langle x'|\hat{U}|\psi\rangle=\int \frac{dx}{\sqrt{2\pi}}\langle x'|\hat{U}|x\rangle \langle x|\psi\rangle
\end{equation}
and I've used the measure $dx/\sqrt{2\pi}$ to keep Fourier transforms unitary.
All this stuff still works in $m$-dimensions where the $A,B,C,D$ parameters become matrices. The use of the following $m$-dimensional integral,
\begin{equation}
\int d^{m}x \exp{(-x^{T}Cx+b^{T}x)}=\frac{\pi^{m/2}}{\sqrt{\det{C}}}\exp{\left(\frac{1}{4}b^{T}C^{-1}b\right)}
\end{equation}
means that any problem involving Gaussian beams propagating through optical systems described by ray matrices can be solved analytically. There are analogous formulas for the unitary operator in momentum basis and in mixed position and momentum basis in terms of the ray matrix parameters. It's often useful to use position basis and momentum basis to simplify the algebra. 
I first learnt this stuff from "Symplectic techniques in physics" by Guillemin and Sternberg. I wish undergraduate physics courses would explain to students that quantum mechanics is not "weird" because it's the same as diffractive optics in the Fresnel approximation and nobody ever says diffractive optics is "weird".
