\documentclass[a4paper,11pt]{article}
\parskip=1.5ex
\usepackage{verbatim,a4margins}

\newcommand{\dd}[2]{\frac{\mathrm d #1}{\mathrm d #2}}
\newcommand{\dds}[2]{\frac{\mathrm d^2 #1}{{\mathrm d #2}^2}}
\newcommand{\pdd}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\pdds}[2]{\frac{\partial^2 #1}{\partial{#2}^2}}
\newcommand{\pddd}[3]{\frac{\partial^2 #1}{\partial #2\partial #3}}

\newcommand{\rowfour}[4]{\left[\begin{array}{cccc}#1&#2&#3&#4\end{array}\right]}
\newcommand{\vectwo}[2]{\left[\begin{array}{c}#1\\#2\end{array}\right]}
\newcommand{\mxtwo}[4]{\left[\begin{array}{cc}#1&#2\\#3&#4\end{array}\right]}

\newcommand{\sq}[1]{\left(#1\right)^2}

\newcommand{\bb}{\mathbf b}
\newcommand{\s}{\mathbf s}
\newcommand{\vv}{\mathbf v}
\newcommand{\cc}{\mathbf c}
\newcommand{\I}{\mathrm i}
\newcommand{\e}{\mathrm e}

\begin{document}

\title{Calculating Coupled Tunes from a 4D Transfer Matrix}
\author{Stephen Brooks}
\maketitle

\section{Assumptions}\label{-ass}

The behaviour of a repeating accelerator cell around a closed orbit phase space position $\s_0=(x_0,x'_0,y_0,y'_0)$ can be approximated by a matrix mapping
\[ \s_0 + \delta\s \quad\rightarrow\quad \s_0 + A\delta\s, \]
where $A$ is a $4\times 4$ matrix.  Since the entries of $A$ are real, its eigenvalues will either be real or appear as complex conjugate pairs.  It is also assumed that the optics are stable in both phase space planes, so no eigenvalues can have modulus greater than one.  As phase space volume in conserved (Liouville's theorem), the product of the eigenvalues has modulus exactly one.  These two conditions imply that every eigenvalue has modulus one (any smaller values would make the product less than one).

\section{Characteristic Polynomial}

If $\lambda$ is an eigenvalue of $A$, then $A\mathbf v = \lambda \mathbf v$ for some nonzero vector $\mathbf v$ and therefore $(A-\lambda I)\mathbf v = \mathbf 0$.  This means that $\det(A-\lambda I)=0$ for eigenvalues $\lambda$.  In fact $p(\lambda) = \det(A-\lambda I)$ is a polynomial of order 4, so is determined by its four roots up to a constant factor.  We already know that $p(0) = \det A=1$ so the constant term in $p$ is one.  For large $\lambda$ the determinant behaves like $(-\lambda)^4$, so the leading term is also one.

The fact that all the eigenvalues have modulus one and will occur in conjugate pairs if complex means that without loss of generality, they can be written $\e^{\pm\I\phi_n}$ for $n=1,2$.  This allows $p$ to be written explicitly in terms of the tunes $\phi_n$:
\begin{eqnarray*}
p(\lambda) &=& \prod_{n=1}^2 (\lambda-\e^{\I\phi_n})(\lambda-\e^{-\I\phi_n}) = \prod_{n=1}^2 (\lambda^2 - 2\lambda \cos \phi_n + 1) \\
&=& \lambda^4 - 2\lambda^3(\cos\phi_1+\cos\phi_2) + \lambda^2(2 + 4\cos\phi_1\cos\phi_2) - 2\lambda(\cos\phi_1+\cos\phi_2) + 1.
\end{eqnarray*}
Thus if the coefficients of $p$ are known, the sum and product of the cosines of the tunes can be found.  This will determine $\cos\phi_n$ up to swapping $\phi_1\leftrightarrow\phi_2$.

\section{Coefficients of $\det(A-\lambda I)$}
The determinant of a general $N\times N$ matrix $M$ is given by the sum over $N!$ permutations
\[ \det M = \sum_{\mathrm{perms}\ \pi} \epsilon_\pi \prod_{n=1}^N m_{n\pi(n)}, \]
where $\epsilon_\pi=\pm1$ is the signature of the permutation $\pi$, which alternates under swapping two elements and is $+1$ for the identity permutation.

For the case $M = A-\lambda I$, we have $m_{ij} = a_{ij}$ for $i\ne j$ and $m_{ii} = a_{ii} - \lambda$ on the diagonal.  Hence any $\lambda^n$ term in $p(\lambda)$ must come from permutations that map at least $n$ elements to themselves, so they hit at least $n$ diagonal elements of $M$.

\subsection{$\lambda^4$ Coefficient}
There is only one permutation that maps 4 out of 4 elements to themselves and that is the identity permutation 1234, with signature $\epsilon_{1234}=+1$.  Therefore the $\lambda^4$ coefficient of $p$ must be the same as in
\[ \epsilon_{1234}m_{11}m_{22}m_{33}m_{44} = (-\lambda)^4 + ..., \]
so it is equal to one as expected.

\subsection{$\lambda^3$ Coefficient}
No permutation can move just one element out of place because there is nowhere for it to go if the other $N-1$ elements remain where they are.  So the identity is still the only permutation that matters for the $\lambda^3$ coefficient, which can be found in the expression below:
\[ \epsilon_{1234}m_{11}m_{22}m_{33}m_{44} = (-\lambda)^4 + (-\lambda)^3(a_{11}+a_{22}+a_{33}+a_{44}) + ..., \]
giving the $\lambda^3$ coefficient to be $-(a_{11}+a_{22}+a_{33}+a_{44}) = -\mathrm{Tr}\,A$.

\subsection{$\lambda^2$ Coefficient}
This is the final coefficient required for determining the tunes.  As well as 1234 there are now the single-swap permutations 1243, 1324, 1432, 2134, 3214, 4231, which have $\epsilon_\pi=-1$.  The $\lambda^2$ coefficient coming from the 1234 product is:
\[ a_{11}a_{22} + a_{11}a_{33} + a_{11}a_{44} + a_{22}a_{33} + a_{22}a_{44} + a_{33}a_{44}. \]
Each single-swap permutation produces a term like the following:
\[ \epsilon_{1243}m_{11}m_{22}m_{34}m_{43} = (-1)((-\lambda)^2a_{34}a_{43} + ...), \]
so the total contribution of the swap terms to the $\lambda^2$ coefficient is
\[ -a_{34}a_{43}-a_{23}a_{32}-a_{24}a_{42}-a_{12}a_{21}-a_{13}a_{31}-a_{14}a_{41}. \]
More compactly, the $\lambda^2$ coefficient can be written $\sum_{1\le i<j \le 4} a_{ii}a_{jj}-a_{ij}a_{ji}$.

\section{Conclusion}

Combining the results from previous sections gives for the $\lambda^3$ coefficient
\newcommand{\tfrac}[2]{\mbox{\small$\frac{#1}{#2}$}}
\begin{eqnarray*}
- 2(\cos\phi_1+\cos\phi_2) &=& -\mathrm{Tr}\,A \\
\Rightarrow \quad S := \cos\phi_1+\cos\phi_2 &=& \frac12 \mathrm{Tr}\,A
\end{eqnarray*}
and for the $\lambda^2$ coefficient
\begin{eqnarray*}
2 + 4\cos\phi_1\cos\phi_2 &=& \sum_{1\le i<j \le 4} a_{ii}a_{jj}-a_{ij}a_{ji} \\
\Rightarrow \quad P := \cos\phi_1\cos\phi_2 &=& \frac14\sum_{1\le i<j \le 4}(a_{ii}a_{jj}-a_{ij}a_{ji}) - \frac12.
\end{eqnarray*}

From this sum and product, the cosines can be determined via a quadratic equation:
\begin{eqnarray*}
 S = \cos\phi_1+\cos\phi_2 &=& \cos\phi_1+P/\cos\phi_1 \\
\Rightarrow \quad S \cos\phi_1 &=& (\cos\phi_1)^2+P \\
\Rightarrow \quad (\cos\phi_1)^2-S \cos\phi_1+P &=& 0 \\
\Rightarrow \quad (\cos\phi_1 - S/2)^2 -(S/2)^2+P &=& 0 \\
\Rightarrow \quad \cos\phi_1 &=& S/2 \pm \sqrt{(S/2)^2 - P}.
\end{eqnarray*}
Because the choice of $\phi_1$ rather than $\phi_2$ here was arbitrary, the two $\pm$ solutions give both tune cosines.  The cosines can place the fractional tunes $\phi_n$ on the interval $[0,\pi]$; information about the `integer' part of the tune (complete phase space rotations within the cell) is not contained in the transfer matrix $A$.

\end{document}