I have an SDE $$d X_t = \left(a(t) + b(t) X_t\right) dt + \left(c(t) + e(t) X_t\right) dW_t $$ where $a, b, c, e$ are deterministic functions.
I would like to derive the ODE for $s(t) = \mathrm{Var}(X_t)$.
I have come up with a derivation, but I don't know how to formalize it.
$$ \begin{aligned} \mathrm{Var}(X_{t+dt}) &= \mathrm{Var}(X_{t+dt}) \\ &= \mathrm{Var}(X_t + dX_t) \\ &= \mathrm{Var}(X_t + \left(a(t) + b(t) X_t\right) dt + \left(c(t) + e(t) X_t\right)dW_t) \\ &= \mathrm{Var}(X_t) + b(t)^2 dt^2 \mathrm{Var}(X_t) + c(t)^2 dt + e(t)^2 \left(\mathrm{Var}(X_t) + E(X_t)^2\right)dt + \text{cov terms} \end{aligned} $$
If I continue by dropping the $dt^2$ and $dW_t dt$ terms above, I'm able to derive an ODE.
Is it okay to do this? If so, is there a theorem I could use here?
I think it would be more natural to ask for an integral equation more than an ODE, because of the nature of SDE. I will drop the differential notation because it can lead to confusion in this case.
To simplify the notation let's assume $X_0=0$. For the martingale property of the Brownian motion we have $$ \mathbb{E}\left[X_t\right]=\int_0^ta(s)+b(s)\mathbb{E}[X_s] ds $$ By the Ito isometry $$ \mathbb{E}\left[\left(\int_0^t c(s)+e(s)X_s dW_s\right)^2\right]=\mathbb{E}\left[\int_0^t \left(c(s)+e(s)X_s\right)^2 ds\right] $$ So $$ \mathbb{E}[X_t^2]=\mathbb{E}\left[\int_0^t \left(a(s)+b(s)X_s\right)^2 + \left(c(s)+e(s)X_s\right)^2 ds \right] $$
so you have (by using Fubini to take the expectation inside the integral ) $$ \mathbb{E}[X_t^2]=\int_0^t \left((b^2+e^2) \mathbb{E}[X_s^2]+2(ab+ce) \mathbb{E}[X_s]+a^2 +c^2\right) ds $$ If the argument of the integral is at least continuous you can use the fundamental theorem of calculus to obtain an ODE for $\mathbb{E}[X_t^2]$.
For the variance instead you obtain $$ \operatorname{Var}(X_t)=\int_0^t \left((b^2+e^2) \mathbb{E}[X_s^2]+2(ab+ce) \mathbb{E}[X_s]+a^2 +c^2 \right)ds-\mathbb{E}[X_t]^2 $$ that seems to depend on $\mathbb{E}[X_s^2]$ and $\mathbb{E}[X_s]$ in a not trivial way.
here there is a discussion on the general solution of a linear SDE. If you need to calculate the variance i will suggest to use that solution to do an explicit calculation