I am learning matrix calculus and I would like to understand how the derivative of the following function: $$ \mathit{f}(\mathbf{x}) = \mathbf{x}^T \mathbf{Ax} $$ is calculated.
I am able to derive the differentials up to this point: $$ \mathrm{d}\mathit{f} = \mathrm{d}\mathbf{x}^T \mathbf{A} \mathbf{x} + \mathbf{x}^T \mathbf{A} \mathrm{d}\mathbf{x} $$ In my book it is further simplified to: $$ \mathrm{d}\mathit{f} = (\mathbf{A} + \mathbf{A}^T)\mathbf{x}\mathrm{d}\mathbf{x} $$ According to what rules have they simplified this? How did they decide on what to transpose and in what order? I guess there is a reasoning behind this other than "I want to have $\mathrm{d}\mathbf{x}$ on the right side and the dimensions must match".