In "http://rail.eecs.berkeley.edu/deeprlcourse/static/slides/lec-10.pdf", the instructor says that LQR works in stochastic dynamics in the same way as it works in deterministic dynamics, and mentions that the expectation of a quadratic under a Gaussian has an analytic solution.
What's the analytic result of the following expectation? $$ E_{X\sim\mathcal N(\mu,\Sigma)}\left[X^TAX+X^TB+ C\right] $$
$$X^TAX+X^TB+C=\sum_{i,j}a_{ij}X_iX_j+\sum_{i}b_iX_i+C$$ Therefore $$ \mathbb E\left[X^TAX+X^TB+ C\right]=\mathbb E\left[\sum_{i,j}a_{ij}X_iX_j+\sum_{i}b_iX_i+C\right] $$ $$ = \sum_{i,j}a_{ij}\mathbb E[X_iX_j]+\sum_{i}b_i\mathbb E[X_i]+C $$ Here $$ \mathbb E[X_iX_j] = \sigma_{ij}+\mu_i\mu_j,\quad \mathbb E[X_i]=\mu_i. $$ Finally, $$ \mathbb E\left[X^TAX+X^TB+ C\right]=\sum_{i,j}a_{ij}\sigma_{ij} + \mu^TA\mu + \mu^TB+C $$ As Did noted in comment below, the answer can be rewritten as follows: $$ \mathbb E\left[X^TAX+X^TB+ C\right]=\textrm{tr}(A\Sigma) + \mu^TA\mu + \mu^TB+C. $$