# Matrix division \\ for sparse and singular matrices

**URL:** <https://discourse.julialang.org/t/matrix-division-for-sparse-and-singular-matrices/68253>\
**Category:** General Usage\
**Tags:** linearalgebra, sparse\
**Created:** [September 16, 2021, 10:52am UTC](https://discourse.julialang.org/t/matrix-division-for-sparse-and-singular-matrices/68253 "2021-09-16T10:52:36Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Post date:** [September 16, 2021, 11:37am UTC](https://discourse.julialang.org/t/matrix-division-for-sparse-and-singular-matrices/68253/4 "2021-09-16T11:37:10Z")

</div>

> [@Why does julia systematically fails when doing \\ operation?](https://discourse.julialang.org/t/why-does-julia-systematically-fails-when-doing-operation/67242/9):
>
> It appears that the convention adopted by Julia is that the backslash symbol used in x = A\b with a square A matrix really stands exclusively for the inverse of a matrix (computed perhaps using LU decomposition). If A is singular (or detected close to singular), the call of x= A\b fails. In such situations, SVD is your friend: julia\> G = svd(A) SVD{Float64, Float64, Matrix{Float64}} U factor: 3×3 Matrix{Float64}: -0.332289 0.850246 0.408248 -0.549449 0.177311 -0.816497 -0.766609 -0.4…

Compare with

```julia
julia> x1p = pinv(A1)*B1
2-element Vector{Float64}:
 1.9999999999999993
 1.9999999999999993

```

---

_[View the full topic](https://discourse.julialang.org/t/matrix-division-for-sparse-and-singular-matrices/68253)._
