I've been looking for a function that helps me get the adjoint matrix o a given one, I found that you can get the cofactors of a matrix but only by using the "Combinatorica" package, which I couldn't get.

If you know any command or if you know effective ways of creating a function that does this, please help me.

  • $\begingroup$ Can you explain what is the "adjunct"? $\endgroup$ – Szabolcs Nov 28 '13 at 1:30
  • $\begingroup$ @Szabolcs Adjoint - in Spanish is "Adjunta" $\endgroup$ – Dr. belisarius Nov 28 '13 at 1:33
  • 2
    $\begingroup$ Take a look at the help for Minors[], under "Applications" $\endgroup$ – Dr. belisarius Nov 28 '13 at 1:38
  • $\begingroup$ I've found the translation "adjunt" so I wasn't sure it was the same "adjoint" $\endgroup$ – DavidBecharaSenior Nov 28 '13 at 1:39
  • $\begingroup$ Well, please check the Wikipedia page I linked to be sure $\endgroup$ – Dr. belisarius Nov 28 '13 at 1:40

This is just to get an answer on record so the question can be removed from not-answered list.

The following is taken from an example given in Application section of the documentation for Minors.

Define the adjoint of a matrix:

adj[m_] := 
    Map[Reverse, Minors[Transpose[m], Length[m] - 1], {0, 1}] * 
      Table[(-1)^(i + j), {i, Length[m]}, {j, Length[m]}]
  • 2
    $\begingroup$ Well done. But you're wrong: the question gets removed from the unanswered pile only after it has upvoted answers. Wait... now you're right :) $\endgroup$ – Dr. belisarius Nov 28 '13 at 4:40
  • 1
    $\begingroup$ I realize there is a risk involved, but usually there is someone willing to take the bait :) $\endgroup$ – m_goldberg Nov 28 '13 at 12:44
  • $\begingroup$ We're all for the rep here :) $\endgroup$ – Dr. belisarius Nov 28 '13 at 12:56
  • $\begingroup$ @belisarius. Rep? What rep? This is pro bono work (CW). $\endgroup$ – m_goldberg Nov 28 '13 at 13:06
  • $\begingroup$ That was the reason for my smiley! $\endgroup$ – Dr. belisarius Nov 28 '13 at 13:22

Here is a simpler answer:

adj[m_] := Inverse[m] Det[m]
  • $\begingroup$ Nicely done.$\phantom{}$ $\endgroup$ – J. M. is in limbo Jun 18 '15 at 13:05
  • 1
    $\begingroup$ This only works for square matrices. The classical adjoint (also called the adjugate) can be defined for matrices of any dimension, and the answer above by @m_goldberg is the correct way to do it for non-square matrices. $\endgroup$ – Michael Seifert Jun 18 '15 at 14:11
  • 4
    $\begingroup$ And only works if the inverse exists. $\endgroup$ – David Aug 7 '15 at 18:55
  • $\begingroup$ @MichaelSeifert Does the accepted answer work for you on non-square matrices? It doesn't for me. I think that's because the {i,length[m]} and {j,length[m]} terms end up making a square table. $\endgroup$ – MikeB Oct 14 '19 at 3:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.