1
$\begingroup$

Curious if there is a way to save time with scalar product multiplication with several variables?

I have a 8x4 matrix and i wanna check if all the columns are orthogonal with each other, so ive taken each column and added them to a variable, lets call them a,b,c,d.

Is there a neat way to test all possible scalar products against each other without having to type way to much, even though now its only 4 variables, im thinking that what if i have 100 variables i wanna test against each other?

Assignment

Here is the matrix A from the assignment if you're interested. :)

A = {{-6, -3, 6, 1}, {-1, 2, 1, -6}, {3, 6, 3, -2}
   , {6, -3, 6, -1}, {2, -1, 2, 3}, {-3, 6, 3, 2}
   , {-2, -1, 2, -3}, {1, 2, 1, 6}
   };
$\endgroup$
0

1 Answer 1

1
$\begingroup$

You may use "Outer" for this purpose:

a = {{-6, -3, 6, 1}, {-1, 2, 1, -6}, {3, 6, 3, -2}, {6, -3, 
    6, -1}, {2, -1, 2, 3}, {-3, 6, 3, 2}, {-2, -1, 2, -3}, {1, 2, 1, 
    6}};

Outer[#1 . #2 &, Transpose@a, Transpose@a, 1] // MatrixForm

enter image description here

$\endgroup$
1
  • $\begingroup$ Even simpler would be Transpose[a].a $\endgroup$
    – bill s
    Jan 6, 2023 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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