I need to differentiate the function $u$ shown below with respect to a vector $\psi$: ($a, c$ and $f$ are constants)
$u(\psi) =\left[\begin{array}{cccc} a & f & 0 & 0\\ c & a & f & 0\\ 0 & c & a & f\\ 0 & 0 & c & a \end{array}\right]\left[\begin{array}{c} \psi^{1}\\ \psi^{2}\\ \psi^{3}\\ \psi^{4} \end{array}\right]$
I'm thinking that the answer would be: $\left[\begin{array}{cccc} a & f & 0 & 0\\ c & a & f & 0\\ 0 & c & a & f\\ 0 & 0 & c & a \end{array}\right]$ by working out the derivative of each term of the matrix with respect to its corresponding $\psi$. But I was hesitant that the function could be written as:
$u=\left[\begin{array}{c} a\psi^{1}+f\psi^{2}\\ c\psi^{1}+a\psi^{2}+f\psi^{3}\\ c\psi^{2}+a\psi^{3}+f\psi^{4}\\ c\psi^{3}+a\psi^{4} \end{array}\right]$ and hence its derivative will just be: $\left[\begin{array}{c} a\\ a\\ a\\ a \end{array}\right]$, if the rows were differentiated with respect to only the corresponding $\psi$. Please let me know which is correct. I think the first one, but need to be sure.