Derivative of trace of tensor

Let $\phi(\mathbf{Q}) = \mathrm{tr}(\mathbf{Q}^2) = \mathbf{I}:\mathbf{Q}^2 $. We use here the Frobenius inner product and $\mathbf{I}$ is the identity matrix.

The differential writes $$ d\phi = \mathbf{I}:\mathbf{Q} (d\mathbf{Q}) + \mathbf{I}:(d\mathbf{Q})\mathbf{Q} $$ We deduce the gradient is $$ \mathbf{Q}+\mathbf{Q}^T $$ If the tensor is traceless, so does the gradient. If the tensor is symmetric, the gradient writes $2\mathbf{Q}$.