Q:

How can I get the following equation w.r.t. positive semidefinite symmetric matrix?

There are matrices; $x_k$, $u_k$, $A_k$, $B_k$, and $Q_k$ whose dimension are $[n\times1]$, $[m\times1]$, $[n\times n]$, $[n\times m]$, and $[n\times n]$, respectively, such that $$x_{k+1}=A_kx_k+B_ku_k+w_k.$$
Another condition is that the matrices $Q_k$ are positive semidefinite symmetric.

My textbook jumped from the equation (1) to the equation (2), regarding very natural and of course.
$$
\mathbf{E}\left(A_{N-1}x_{N-1}+B_{N-1}u_{N-1}+w_{N-1}\right)'Q_N\left(A_{N-1}x_{N-1}+B_{N-1}u_{N-1}+w_{N-1}\right) \tag1
$$
$$
u'_{N-1}B'_{N-1}Q_NB_{N-1}u_{N-1}+2x'_{N-1}A'_{N-1}Q_NB_{N-1}u_{N-1}+x'_{N-1}A'_{N-1}Q_NA_{N-1}x_{N-1}+\mathbf{E}\left(w'_{N-1}Q_Nw_{N-1}\right) \tag 2
$$

But I don't say before that the matrices $w_k$ whose each element has zero-mean distribution. I can follow almost steps except that how can it become
$$x'_{N-1}A'_{N-1}Q_NB_{N-1}u_{N-1}+u'_{N-1}B'_{N-1}Q_NA_{N-1}x_{N-1} = 2x'_{N-1}A'_{N-1}Q_NB_{N-1}u_{N-1}.$$
I can guess it could be from the semi-definite symmetric property of $Q_k$. Can someone explain with a detail? Thank you.

A:

The trick here is that the $Q$ matrix is symmetric, so the two terms on the left side of your equation are transposes of each other.  Since both terms are scalars (1 by 1 matrices), they're equal, and you immediately get the expression on the right hand side.  

