# Multivariate gaussian distribution in imm filter

I'm try to implement an Imm filter. In one step I need to perform the multivariate gaussian probability function. The problem is that the covariance matrix S of the filter has a negative determinant. My questions:

1. Is it possible to have a negative determinant? The S matrix is a positive semi-definite matrix so I think it's not possible at all, right?
2. If for some reason a negative determinant is found, what could I do in my filter? How to recover from a mathematical point of view?

If it is becoming indefinite due to numerical roundoff, you can replace $S$ with $S + \epsilon I$ for some small $\epsilon >0$. If $S$ is symmetric and $\epsilon \geq \lambda_{min} (S)$, this matrix is positive semi-definite (which you can check from the Raleigh quotient). This is called diagonal loading.
Also, you can propagate a square root of $S$ (e.g. a Cholesky decomposition or something). Square root filters for RLS/Kalman are relatively common and covered in literature (e.g. Haykin's Adaptive filter theory).