How do you differentiate the function$$y_t=E(x_t)^2$$where $x_t = x_0+ar_t+c_t$, $E(c)=0$ and variance = $σ(u)^2$, and $x_0$ is a constant.
I am unsure if my reasoning is correct in the method below.$$y_t=E(x_0+ar_t+c_t)^2$$$$y_t=E(x_0^2-2x_0ar_t+2x_0c_t+a^2r_t^2-2ar_tc_t+c_t^2)$$if I were to differentiate this function with respect to $r_t$, would I differentiate the function before considering the expected value?