# Multivariable Taylor expansion give incorrect answer

I have a matrix $$M(\text{kx\_},\text{ky\_})=\left( \begin{array}{cc} a_2 (1-\cos (\text{kx}) \cos (\text{ky}))+a_1 (1-\cos (\text{kx})) & 2 a_2 \sin (\text{kx}) \sin (\text{ky}) \\ 2 a_2 \sin (\text{kx}) \sin (\text{ky}) & a_2 (1-\cos (\text{kx}) \cos (\text{ky}))+a_1 (1-\cos (\text{ky})) \\ \end{array} \right)$$

M[kx_, ky_] = ({
{Subscript[a, 1] (1 - Cos[kx]) +
Subscript[a, 2] (1 - Cos[kx] Cos[ky]),
2 Subscript[a, 2] Sin[kx] Sin[ky]},
{2 Subscript[a, 2] Sin[kx] Sin[ky],
Subscript[a, 1] (1 - Cos[ky]) +
Subscript[a, 2] (1 - Cos[kx] Cos[ky])}
});

I want to find the eigenvalues and eigenvectors at the limit of kx$$\to$$0 and ky$$\to$$0 in any direction of $$\vec k$$.

If I define ky=0

In[57]:= Eigensystem[M[kx, 0]]

Out[57]= {{(-1 + Cos[kx]) (-Subscript[a, 1] - Subscript[a,
2]), -(-1 + Cos[kx]) Subscript[a, 2]}, {{1, 0}, {0, 1}}}

Eigenvalue is $$(a_1+a_2) (1-\cos (\text{kx})),a_2 (1-(\cos (\text{kx}))$$

In the limit, it is $$(a_1+a_2)\text{kx}^2/2,a_2 \text{kx}^2/2$$

If I define kx=0

In[58]:= Eigensystem[M[0, ky]]

Out[58]= {{(-1 + Cos[ky]) (-Subscript[a, 1] - Subscript[a,
2]), -(-1 + Cos[ky]) Subscript[a, 2]}, {{0, 1}, {1, 0}}}

Eigenvalue is $$(a_1+a_2) (1-\cos (\text{ky})),a_2 (1-(\cos (\text{kx}))$$

In the limit, it is $$(a_1+a_2) \text{ky}^2/2,a_2\text{kx}^2/2$$

The problem occurs when I series expand Eigenvalue of $$M(\text{kx},\text{ky})$$

In[61]:= Series[Eigensystem[M[kx, ky]], {kx, 0, 2}, {ky, 0, 2},
Assumptions -> {Subscript[a, 1] > 0, Subscript[a, 2] > 0, kx > 0,
ky > 0}]

It gives eigenvalues

$$\left(\frac{a_2 \text{ky}^2}{2}+O\left(\text{ky}^3\right)\right)+\text{kx}^2 \left(\left(-\frac{8 a_2^2}{a_1}+\frac{a_2}{2}+\frac{a_1}{2}\right)+\left(\frac{2 a_2^2}{a_1}-\frac{a_2}{4}\right) \text{ky}^2+O\left(\text{ky}^3\right)\right)+O\left(\text{kx}^3\right)$$

and

$$\left(\left(\frac{a_1}{2}+\frac{a_2}{2}\right) \text{ky}^2+O\left(\text{ky}^3\right)\right)+\text{kx}^2 \left(\left(\frac{8 a_2^2}{a_1}+\frac{a_2}{2}\right)+\left(-\frac{2 a_2^2}{a_1}-\frac{a_2}{4}\right) \text{ky}^2+O\left(\text{ky}^3\right)\right)+O\left(\text{kx}^3\right)$$

It agree with previous answer in the direction of kx=0 but disagree in the direction of ky=0

If I do series expansion with the order of $$\{\text{ky},0,2\},\{\text{kx},0,2\}$$, it becomes opposite.

What causes this bug and how can I get the correct answer?

Update I rewrite to matrix in polar coordinate k and $$\theta_k$$ and series expand only to k. It is correct this time, but problem still remain in cartesian coordinate.

Using variables $$a$$ & $$b$$ instead of subscripts, we calculate the eigenvalues for 3 different conditions.

M[kx_, ky_] := ({{a (1 - Cos[kx]) + b (1 - Cos[kx] Cos[ky]),
2 a Sin[kx] Sin[ky]}, {2 a Sin[kx] Sin[ky],
a (1 - Cos[ky]) + b (1 - Cos[kx] Cos[ky])}});
M[kx, ky] // MatrixForm

q1 = Eigenvalues[M[kx, 0]];
q2 = Eigenvalues[M[0, ky]];
q3 = Eigenvalues[M[kx, ky]];

We can do the usual series expansion on the first 2 sets of eigenvalues

s1 = Collect[Normal@Series[q1, {kx, 0, 2}], kx];
s2 = Collect[Normal@Series[q2, {ky, 0, 2}], ky];

But, for the third set of eigenvalues we use this trick to get its series expansion

s3 = Collect[Normal@Series[
q3 /. kx -> kx*z /. ky -> ky*z, {z, 0, 2}] /. z -> 1,
{kx, ky}];

Now we can take the limits of s3 to obtain s1 and s2

t1 = Simplify@PowerExpand@Limit[s3, ky -> 0];
t2 = Simplify@PowerExpand@Limit[s3, kx -> 0];

t1 and t2 are the same eigenvalues are s1 and s2, but in a different order

{Sort[s1] == Sort[t1],
Sort[s2] == Sort[t2]} // Simplify

(*  {True, True}  *)
• Great answer! The "z" parameter trick. Can you tell me what is your mathmetica version? Mine is 11.3. When I run your code, t1 and t2 contain kx^2 or ky^2 term. It is different with your result. Others are all fine.
– p.s
Commented Sep 11, 2019 at 17:18
• @p.s My version is "12.0.0 for Linux x86 (64-bit) (April 7, 2019)". I get the same result with "11.0.1 for Linux x86 (64-bit) (September 21, 2016)" and with "10.4.0 for Linux x86 (64-bit) (February 26, 2016)". However, my results with "11.3.0 for Microsoft Windows (64-bit) (March 7, 2018)" are different. The 11.3 results contain kx^4 and ky^4. Commented Sep 12, 2019 at 0:22
• @p.s I also get the kx^4 and ky^4 results with both "11.3.0 for Linux x86 (64-bit) (March 7, 2018)" and "11.3.0 for Linux ARM (32-bit) (May 23, 2018)", so it's not a MS Windows thing. Commented Sep 12, 2019 at 0:57