What are the eigenvalues of the given matrix $M$ I am learning linear algebra and now I'm in eigenvalues and eigenvectors part of it. there is a question that I can't solve it or any idea that I have is hard and nasty. I think this question must have a trick that I am not familiar with it because I'm new to eigenvalues and eigenvectors. 
the question is this:

Let $M \in \Bbb R^{n\times n}$ and real numbers $a_1$ to $a_n$
  and every $m_{ij} = \frac{a_i}{a_j}$, so:
  $$ M =   \begin{pmatrix}1&\cdots&\frac{a_1}{a_n}\\\vdots&\ddots&\vdots\\\frac{a_n}{a_1}&\cdots&1\end{pmatrix} $$
  find all eigenvalues.

any help would be appreciated.
 A: Another way to do this is by noting that if $\mathbf{a} = (a_1, \dots, a_n)^\top$ and $\mathbf{b} = (1/a_1, \dots, 1/a_n)^\top$, then
$$
M = \mathbf{a} \mathbf{b}^\top,
$$
where $\mathbf{b}^\top$ denotes the transpose of $\mathbf{b}$. The rank of $M$ is therefore 1 (can you see why?), meaning that only one eigenvalue is non-zero. This eigenvalue is found by considering
$$
M \mathbf{a} = (\mathbf{a} \mathbf{b}^\top) \mathbf{a} = \mathbf{a} (\mathbf{b}^\top \mathbf{a}) = n \mathbf{a},
$$
i.e. the final eigenvalue is $n$.
A: To find the eigenvalues, we are calculating the zeroes of the characteristic polynomial of $M$.
$$0= \det(M - \lambda I) = \begin{vmatrix} 1-\lambda &\frac{a_1}{a_2} & \cdots & \frac{a_1}{a_n} \\
\frac{a_2}{a_1} & 1-\lambda & \cdots & \frac{a_2}{a_n} \\
\vdots & \vdots & \ddots & \vdots \\
\frac{a_n}{a_1} & \frac{a_n}{a_2} & \cdots & 1-\lambda
\end{vmatrix}$$
Since $a_1, \ldots, a_n \ne 0$, we can multiply $j$-th column by $a_j$ for $j = 1, \ldots, n$ to obtain:
$$0 = \begin{vmatrix} a_1(1-\lambda) & a_1 & \cdots & a_1 \\
a_2 & a_2(1-\lambda) & \cdots & a_2 \\
\vdots & \vdots & \ddots & \vdots \\
a_n & a_n & \cdots & a_n(1-\lambda)
\end{vmatrix}$$
Now divide $i$-th row by $a_i$ for $i =1, \ldots, n$ to obtain
\begin{align}
0 &= \begin{vmatrix} 1-\lambda & 1 & \cdots & 1 \\
1 & 1-\lambda & \cdots & 1 \\
\vdots & \vdots & \ddots & \vdots \\
1 & 1 & \cdots & 1-\lambda
\end{vmatrix} \\
&= \begin{vmatrix} 1-\lambda & 1 & \cdots & 1 \\
\lambda & -\lambda & \cdots & 0 \\
\vdots & \vdots & \ddots & \vdots \\
\lambda & 0 & \cdots & -\lambda
\end{vmatrix} \\
&= \begin{vmatrix} n-\lambda & 1 & \cdots & 1 \\
0 & -\lambda & \cdots & 0 \\
\vdots & \vdots & \ddots & \vdots \\
0& 0 & \cdots & -\lambda
\end{vmatrix} \\
&= (n-\lambda)(-\lambda)^{n-1}
\end{align}
so the eigenvalues are $0$ and $n$.
A: We can write your matrix as $M = DJD^{-1}$, where
$$
D = \pmatrix{a_1\\ & \ddots \\ && a_n}, \quad 
J = \pmatrix{1 & \cdots & 1\\ \vdots & \ddots & \vdots \\ 1 & \cdots & 1}
$$
So, $M$ is similar to $J$.  $J$ is a rank $1$ symmetric matrix, so it's only non-zero eigenvalue will be $\operatorname{tr}(J) = n$.
We could also recognize that $M$ has rank $1$ as Robert did in his comment.
