# Solving AX=B with a matrix B of right-hand sides

**URL:** <https://discourse.julialang.org/t/solving-ax-b-with-a-matrix-b-of-right-hand-sides/125282>\
**Category:** Numerics\
**Tags:** linearalgebra\
**Created:** [January 15, 2025, 3:39pm UTC](https://discourse.julialang.org/t/solving-ax-b-with-a-matrix-b-of-right-hand-sides/125282 "2025-01-15T15:39:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 27, 2025, 9:12pm UTC](https://discourse.julialang.org/t/solving-ax-b-with-a-matrix-b-of-right-hand-sides/125282/2 "2025-01-27T21:12:19Z")

</div>

Yes. You should still generally use `X = A \ B`.

The only time `inv(A) * B` becomes more efficient is usually when `size(B,2)` is much greater than `size(B,1)`, and even then only for dense matrices. See: [Why re-use factorization(A) rather than inv(A) - #3 by stevengj](https://discourse.julialang.org/t/why-re-use-factorization-a-rather-than-inv-a/113234/3)

PS. I moved your question to a new thread. Please don’t post new questions on ancient threads.

---

_[View the full topic](https://discourse.julialang.org/t/solving-ax-b-with-a-matrix-b-of-right-hand-sides/125282)._
