# How to find a positive defective matrix?

When can a positive $n\times n$ matrix (with strictly positive entries only) be defective (non-diagonalizable)? It is not hard to show that it's not possible for $n=2$. I was able to find an example of such matrix for $n=3$ (by guessing), and it took me a while.

Although defective matrices are very rare, they are easy to construct, e.g. one can just take a Jordan block. But is there any deterministic way to construct positive defective matrices?

1. Let $J \in \mathbb{R}^{n \times n}$ be a matrix with all elements equal to $1$. It has $1$ eigenvalue equal to $n$ and $n-1$ eigenvalues equal to $0$.
2. Let its Jordan decomposition be $J = S D S^{-1}$, so $S$ is nonsingular and $D = \mathop{\rm diag}(n,0,\dots,0)$.
3. Define $$X = S \left( \mathcal{J} + \alpha D \right) S^{-1} = X' + J, \quad X' := S \mathcal{J} S^{-1}, \quad \mathcal{J} := \mathop{\rm diag} \left( \lambda, \mathcal{J}' \right)$$ where $\lambda \in \mathbb{R}$ is arbitrary, $\mathcal{J}'$ is any Jordan matrix of order $n-1$ with real eigenvalues and at least one Jordan block of order $2$ or more, and $\alpha$ is a sufficiently large real number.
Notice that $\alpha$ determines how much we add to the each element of $X' = \begin{bmatrix} x'_{ij} \end{bmatrix}$, so any $$\alpha \ge -\min \{ x'_{ij}:\ i,j=1,\dots,n \}$$ will result in $X$ being positive. Also, $\mathcal{J} + \alpha D$ is a Jordan matrix of the same form as $\mathcal{J}$, just with different first eigenvalue, so it is nondiagonalizable.