# Using the elements of one Matrix to form a new Matrix with specified rules

Given a matrix [a], how to get matrices [b] and [c] based on the following two rules?

1. rule [a]->[b]: Strike out corresponding term in [a] and take product of the remaining two terms in the same column.
2. rule [a]->[c]: Strike out the row and column containing the corresponding term in [a] and take sum of cross products in the 2×2 matrix remaining.

x,y,z can be replaced with 1,2,3; For example, $$a_{xy},a_{yz}$$ can be replaced with a12,a23; [a] can be replace with:

a = {{a11, a12, a13}, {a21, a22, a23}, {a31, a32, a33}}


Thank you

Matrix [a]

Matrix [b]

Matrix [c]

amat = Array[a, {3, 3}]

(* {{a[1, 1], a[1, 2], a[1, 3]},
{a[2, 1], a[2, 2], a[2, 3]},
{a[3, 1],  a[3, 2], a[3, 3]}} *)


For the first item, if you have no zero elements, then...

Map[Times @@ #/# &, Transpose@amat] // TeXForm


$$\left( \begin{array}{ccc} a(2,1) a(3,1) & a(1,1) a(3,1) & a(1,1) a(2,1) \\ a(2,2) a(3,2) & a(1,2) a(3,2) & a(1,2) a(2,2) \\ a(2,3) a(3,3) & a(1,3) a(3,3) & a(1,3) a(2,3) \\ \end{array} \right)$$

If you have zero elements, then do this.

Transpose@Map[Table[Times @@ Delete[#, i], {i, 3}] &, Transpose@amat]


For the other, what you are asking for is similar to a minor. Use the generalized version of the function...first define a function that takes a 2x2 matrix and determines something similar to the cross product, but all positive terms.

f[m_] := m[[1, 1]] m[[2, 2]] + m[[1, 2]] m[[2, 1]]


Then call Minors passing f[ ] to be used on the submatrices instead of Det. Note we have to explicitly fix size of the submatrices. Also, see help on Minors to get the submatrices with the right rows and columns deleted.

Map[Reverse, Minors[amat, 2, f], {0, 1}]


$$\left( \begin{array}{ccc} a(2,3) a(3,2)+a(2,2) a(3,3) & a(2,3) a(3,1)+a(2,1) a(3,3) & a(2,2) a(3,1)+a(2,1) a(3,2) \\ a(1,3) a(3,2)+a(1,2) a(3,3) & a(1,3) a(3,1)+a(1,1) a(3,3) & a(1,2) a(3,1)+a(1,1) a(3,2) \\ a(1,3) a(2,2)+a(1,2) a(2,3) & a(1,3) a(2,1)+a(1,1) a(2,3) & a(1,2) a(2,1)+a(1,1) a(2,2) \\ \end{array} \right)$$

• I also thought first that it were about the minors; it is not. It think cross product means of a $2 times 2$ matrix in this context refers to $q_{11} q_{22} + q_{12} q_{21}$. Apr 1, 2020 at 17:38
• Ahh, yup. Updated the answer, can still use the Minors function to handle the bookkeeping. Apr 1, 2020 at 18:57
• Ah, Minors allows a third argument. That's great to know! Apr 1, 2020 at 18:59
• @MikeY, Henrik Schumacher. Thank you, it's a perfect solution. Apr 2, 2020 at 2:38