Derivative of equation containing Gaussian filtered image Let $w$ be our image. For example, consider the following with the vectorized $w$:
$$ E(w) = \frac 12 \|Aw+b\|_2^2 $$
I know the optimal condition of the above equation:
$$ \nabla_wE = A^TA\hat w + b = 0 $$

Now, we consider the filtered image by Gaussian such that
$$ E(w) = \frac 12 \|A (G * w)+b\|_2^2 $$

In this case, how to get the optimal condition? (i.e., how to derivative w.r.t $w$?)
You can represent the convolution as a matrix multiplication with a $N\times N$ Toeplitz matrix, where $N$ is the length of $\mathbf{w}$. Check out this explanation.
So you can write
$$
E(\mathbf{w})=\frac{1}{2}\|\mathbf{AHw}+\mathbf{b}\|^2_2
$$
where $\mathbf{H}$ is your Teoplitz matrix filter. Now if you define
$$
\tilde{\mathbf{A}} = \mathbf{AH}
$$
then
$$
E(\mathbf{w})=\frac{1}{2}\|\tilde{\mathbf{A}}\mathbf{w}+\mathbf{b}\|^2_2
$$

And you can see that the solution is exactly as you wrote but with $\tilde{\mathbf{A}}$ instead of $\mathbf{A}$.