# Inverse of a symmetric matrix is not symmetric?

**URL:** <https://discourse.julialang.org/t/inverse-of-a-symmetric-matrix-is-not-symmetric/10132>\
**Category:** General Usage\
**Created:** [April 3, 2018, 3:32am UTC](https://discourse.julialang.org/t/inverse-of-a-symmetric-matrix-is-not-symmetric/10132 "2018-04-03T03:32:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [April 3, 2018, 3:50am UTC](https://discourse.julialang.org/t/inverse-of-a-symmetric-matrix-is-not-symmetric/10132/2 "2018-04-03T03:50:02Z")

</div>

> [@PSA: floating-point arithmetic](https://discourse.julialang.org/t/psa-floating-point-arithmetic/8678):
>
> Sometimes people are surprised by the results of floating-point calculations such as julia\> 5/6 0.8333333333333334 # shouldn't the last digit be 3? julia\> 2.6 - 0.7 - 1.9 2.220446049250313e-16 # shouldn't the answer be 0? These are not bugs in Julia. They’re consequences of the IEEE-standard 64-bit binary representation of floating-point numbers that is burned into computer hardware, which Julia and many other languages use by default. Brief explanation You can t…

All math performed with floating-point numbers is subject to some degree of round-off and approximation. The inverse of your matrix is not perfectly symmetric, but it is very close:

```julia-auto
julia> minv = inv(mat)
6×6 Array{Float64,2}:
  1.18147 -0.502645 0.1883 -0.0692716 0.0250252 -0.0079607
 -0.502645 1.39526 -0.582587 0.217304 -0.0786496 0.0250252
  0.1883 -0.582587 1.42474 -0.59216 0.217304 -0.0692716
 -0.0692716 0.217304 -0.59216 1.42474 -0.582587 0.1883   
  0.0250252 -0.0786496 0.217304 -0.582587 1.39526 -0.502645 
 -0.0079607 0.0250252 -0.0692716 0.1883 -0.502645 1.18147  

julia> minv - minv'
6×6 Array{Float64,2}:
  0.0 -1.11022e-16 2.77556e-17 4.16334e-17 -1.04083e-17 3.46945e-18
  1.11022e-16 0.0 -1.11022e-16 -5.55112e-17 1.38778e-17 -3.46945e-18
 -2.77556e-17 1.11022e-16 0.0 2.22045e-16 -8.32667e-17 1.38778e-17
 -4.16334e-17 5.55112e-17 -2.22045e-16 0.0 1.11022e-16 -5.55112e-17
  1.04083e-17 -1.38778e-17 8.32667e-17 -1.11022e-16 0.0 0.0        
 -3.46945e-18 3.46945e-18 -1.38778e-17 5.55112e-17 0.0 0.0 

```

---

_[View the full topic](https://discourse.julialang.org/t/inverse-of-a-symmetric-matrix-is-not-symmetric/10132)._
