Let $V$ be a vector space so that $W<V$ and $B$ a basis in $W$. If $f$ is and endomorphism in $W$, based on the matrix attached to the function $f$, how can I extend the function to two endomorphisms in $V$ -one diagonalizable and one not-.
My thought was to add a Jordan block after properly extending the matrix and the basis, so then it is non-diagonalizable. On the other hand, to make it diagonalizable adding a lambda eigenvalue while the matrix remains diagonal would do. How would you guys approach this?
Any help is appreciated!
First of all, it is convenient to come up with a complementary subspace $U$. That is, we can guarantee that there exists a subspace $U$ such that $V$ is the (internal) direct sum $V = W \oplus U$, and I will refer to such a subspace $U$ going forward. The specifics of how this complementary subspace might be constructed are not important for our purposes here.
With that established: as you said in your comment, we know that $f:W \to W$ is diagonalizable. In order to extend this to a diagonalizable map over $V$, it suffices to define the extension $\tilde f: V \to V$ such that $U$ is also an invariant subspace of $W$ and $\tilde f|_{U}$ is diagonalizable. For instance, the map $\tilde f$ defined by $$ \tilde f(w + u) = f(w) + u \quad \text{for all }w \in W, u \in U $$ is diagonalizable. In this case, the restriction $\tilde f|_U = \text{id}_U$ is diagonalizable.
If $\dim(U) \geq 2$, then the approach that you seem to have in mind works perfectly well: if $U$ is an invariant subspace of $\tilde f$ such that $\tilde f|_U$ is non-diagonalizable, then $\tilde f$ is non-diagonalizable. However, if $\dim(U) = 1$, the all endomorphisms of $U$ are diagonalizable, so this approach is ruled out.
For the case where $\dim(U) = 1$, the following construction would work: let $\lambda$ be any eigenvalue of $f$. Let $u_*,w_*$ denote elements of $U$ and $W$ respectively, with $u_* \neq 0$ and $w_*\notin \text{Ran}(f - \lambda \text{id}_W)$. Notably, $U = \{tu_* : t \in \Bbb C\}$. Define $\tilde f$ by $$ \tilde f(w + tu_*) = f(w) + tw_* + \lambda t u_*, \quad \text{for all }w \in W, t\in \Bbb C. $$ To see that this map is not diagonalizable, show that $\text{Ran}(\tilde f - \lambda \,\text{id}) \supsetneq \text{Ran}[(\tilde f - \lambda \,\text{id})^2]$.
An illustrative example for constructing the non-diagonalizable extension: suppose that within $\Bbb R^4$, $$ W = \{(x_1,x_2,x_3,x_4): x_4 = 0\}. $$ Suppose that relative to the basis $\mathcal B = \{(1,0,0,0),(0,1,0,0),(0,0,1,0)\}$. Suppose that the matrix of $f:W \to W$ is given by $[f]_{\mathcal B} = A \in \Bbb R^{3 \times 3}$.
The matrix of $\tilde f$ relative to the standard basis $\mathcal S$ of $\Bbb R^4$ (i.e. $\mathcal B$ with the vector $(0,0,0,1)$ added) must be of the form $$ M = [\tilde f]_{\mathcal S} = \pmatrix{A & v\\0 & \lambda} $$ for some scalar $\lambda$ and some vector $v \in \Bbb R^3$. Now, $M$ will be diagonalizable if and only if $(M - \lambda I)$ and $(M - \lambda I)^2$ have the same rank. With that in mind, note that $$ (M - \lambda I)^2 = \pmatrix{A - \lambda I & v\\0 & 0}^2 = \pmatrix{(A - \lambda I)^2 & (A - \lambda I)v\\0 & 0}. $$ Because $A$ is diagonalizable, $(A - \lambda I)$ and $(A - \lambda I)^2$ will have the same range. So, $M$ will fail to be diagonalizable if and only if $v \notin \text{range}(A - \lambda I)$.
To be more specific, consider $$ A = \pmatrix{1 & 0 & 0\\ 0 & 2 & 0\\ 0 & 0 & 3}. $$ Of course, we find that $$ \pmatrix{1&0&0&0\\0&2&0&0\\ 0&0&3&1\\ 0&0&0&3} $$ is not diagonalizable. However, the matrices $$ \pmatrix{1&0&0&0\\0&2&0&0\\ 0&0&3&1\\ 0&0&0&2}, \quad \pmatrix{1&0&0&0\\0&2&0&0\\ 0&0&3&1\\ 0&0&0&1} $$ are diagonalizable, even though $1$ and $2$ are eigenvalues of $A$.