# Is my matrix symmetric?

I obtained a mass matrix through Finite Elements discretization. Now, I want to check if it is symmetric. To do that I subtract to my matrix $M$ its transposed $M^T$. The result is another matrix of which I compute the norm. The norms that I use are max norm defined as $\max(|a_{i,j}|; i,j)$ or infnorm defined as $\max(\sum(|a_{i,j}|,j),i)$. I would expect these norms to be zero but they are in the order of $10^{-19}$ or $10^{-17}$ if I use a coarser mesh. Do you think that it is a numerical problem simply due to finite precision effects?

Thanks

• What's the norm of $M$ itself? – Brian Borchers May 14 '15 at 14:05
• Welcome on Computational Science. Your question is of course legitimate, but you are not providing enough information for giving a sensible answer. Usually one is not concerned with small relative errors $\Vert M-M^T\Vert / \Vert M \Vert$, so you should state what your relative error is, and not only the absolute error. Why you are expecting that $M = M^T$ should hold exactly? – Stefano M May 14 '15 at 14:34
• I would not care to much for such a small relative error. It is quite common in numerical applications. The only concern is to explicitly choose a symmetric solver, to avoid that some sort of "automatic" choosing library could switch to a slower non-symmetric solver. – Stefano M May 14 '15 at 14:48
• @StefanoM is saying that it is usually not a problem. with numerics, the best you can hope to get down to is machine accuracy (you usually won't get to zero), and a lot of solvers don't even get there. what you're looking for is small relative error, and for most applications, $10^{-17}$ is considered small. you're probably fine. – aeroNotAuto May 14 '15 at 15:10
• Your matrix is very close to symmetric. Some codes actually check to make sure that a matrix is exactly symmetric (with equal floating point numbers above/below the diagonal) and might chose to treat a matrix as unsymmetric if this doesn't hold. You can force the symmetry by either copying the upper triangle to the lower triangle or averaging the upper and lower triangular parts (M=(M+M')/2.) – Brian Borchers May 14 '15 at 17:00