Gradient of $\lVert A(X) - b\rVert^2$ with $A$ a linear operator Let $X\in\mathbb{R}^{p\times m}$, $b\in\mathbb{R}^{k}$ and let $A:\mathbb{R}^{p\times m}\to\mathbb{R}^k$ be a linear operator. I need to compute the gradient with respect to $X$ of
$f(X) = \lVert A(X) - b\rVert ^2$ and my claim is that $\nabla f(X) = 2\cdot A^T(A(X) - b)$, there $A^T$ is the transposed operator of $A$. However, I cannot prove it in a simple way that does not involve Fréchet derivatives. Is there a simple way to prove it (if my claim is correct)?

I am posting the answer I got thanks to @Fei Cao's hint.
Let us consider $f(X) = \frac{1}{2}\lVert A(X)-b\rVert^2_2$
\begin{equation}
    \nabla f(X) = A^T(A(X) - b)
\end{equation}
Indeed for $H\in\mathbb{R}^{p\times m}$ it holds:
\begin{align*}
    &f(X+H) - f(X) - \langle A^T(A(X) - b), H\rangle = 
    \frac{1}{2}\lVert A(X) - b + A(H)\rVert^2_2 - \frac{1}{2}\lVert A(X)-b\rVert^2_2 - \langle A(X) - b, A(H)\rangle = \\
    &= \frac{1}{2}\left[\lVert A(X) - b\rVert_2^2 + \lVert A(H)\rVert_2^2 + 2\langle A(X) - b, A(H)\rangle\right] - \frac{1}{2}\lVert A(X)-b\rVert^2_2 - \langle A(X) - b, A(H)\rangle = \\
    & = \frac{1}{2}\lVert A(H)\rVert_2^2 = o(H) \qquad \text{for $H\to 0$}
\end{align*}
