6
$\begingroup$

I have four linearly independent vectors:

$$ \left( \begin{array}{c} \left\{\frac{1}{2},\frac{1}{2},0,0,0,0\right\} \\ \end{array} \right)$$ $$ \left( \begin{array}{c} \left\{\frac{1}{2 \sqrt{3}},-\frac{1}{2 \sqrt{3}},0,0,0,0\right\} \\ \end{array} \right) $$

$$\left( \begin{array}{c} \left\{0,0,0,0,0,\frac{1}{2}\right\} \\ \end{array} \right) $$

$$ \left( \begin{array}{c} \left\{-\frac{1}{3},-\frac{2}{3},-1,-1,-1,-\frac{1}{2}\right\} \\ \end{array} \right) $$

What is the easiest way to compute with Mathematica two more linearly independent vectors, such that I have a complete basis for my vector space?

$\endgroup$
  • 2
    $\begingroup$ If working over the reals, say, you could just pick two random vectors. (And if the result is not a complete basis, shoot your rng.) $\endgroup$ – Daniel Lichtblau Jul 24 '15 at 13:34
  • $\begingroup$ @Daniel Please meet my cousin, Dr. Murphy. $\endgroup$ – Dr. belisarius Jul 24 '15 at 13:36
  • 1
    $\begingroup$ @Belisarius Are you by chance also related to Cole? $\endgroup$ – Daniel Lichtblau Jul 24 '15 at 13:39
  • $\begingroup$ @Daniel, his law is delicious! $\endgroup$ – J. M. is away Jul 27 '15 at 2:34
7
$\begingroup$
b = {{1, 1, 0, 0, 0, 0}, {1, -1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1}, 
     {-1, -2, -3, -3, -3, -3/2}};
h = NullSpace@b

(* {{0, 0, -1, 0, 1, 0}, {0, 0, -1, 1, 0, 0}} *

MatrixRank@Join[b, h]
(* 6 *)
$\endgroup$
  • $\begingroup$ …this is pretty much the textbook solution. :) Had the given number been five instead of four, taking the Cross[] of those five vectors would yield the sixth independent one. $\endgroup$ – J. M. is away Jul 24 '15 at 12:33
  • $\begingroup$ @Guesswhoitis. I remember falling in love with this one many years ago. We were both so young then! $\endgroup$ – Dr. belisarius Jul 24 '15 at 13:26
  • $\begingroup$ ah… :) to be honest, I only appreciated this stuff way after I was no longer in school and took it upon myself to properly learn the damn thing. That book helped a great deal. $\endgroup$ – J. M. is away Jul 24 '15 at 13:30
4
$\begingroup$

As an extended side note,

p = Map[KroneckerProduct[#, #] &] @ Map[Normalize] @ vecs; 
(* You can use Orthogonalize instead of Map[Normalize], too *)

generates a projection matrix that projects any matrix onto your known subspace, and it can be used to subtract off that piece. Examining this matrix,

p
(* {{1, 0, 0, 0, 0, 0}, 
 {0, 1, 0, 0, 0, 0}, 
 {0, 0, 1/3, 1/3, 1/3, 0}, 
 {0, 0, 1/3, 1/3, 1/3, 0}, 
 {0, 0, 1/3, 1/3, 1/3, 0}, 
 {0, 0, 0, 0, 0, 1}}
*)

we see a set of vectors that the solution needs to be orthogonal to. The block in the middle is of particular importance, since in three space, this is just {1,1,1}. So, the solution is the plane orthogonal to that vector.

$\endgroup$
  • $\begingroup$ Orthogonalize[] would be closer to the textbook approach (Gram-Schmidt), actually. $\endgroup$ – J. M. is away Jul 24 '15 at 12:53
  • $\begingroup$ @Guesswhoitis. of course it would, but I was checking that if I retained the less restrictive linear independence, instead of orthogonality, that we would get the same result. It did, so I left it in. $\endgroup$ – rcollyer Jul 24 '15 at 12:55
  • $\begingroup$ @Guesswhoitis. often, though, that form is not taught in linear algebra classes, but it becomes crystal clear if you spend to much time with the bra/ket formalism. :P $\endgroup$ – rcollyer Jul 24 '15 at 12:59
  • $\begingroup$ That's funny; back when I was still learning linear algebra in school, the professor thumbed his nose at the physicists by saying he'd rather eat worms than discuss brackets just as he was discussing Gram-Schmidt in full generality (e.g. at that point, he had already mentioned the Legendre polynomials). Come to think of it… I suppose Projection[] is also usable here. $\endgroup$ – J. M. is away Jul 24 '15 at 13:05
  • $\begingroup$ @Guesswhoitis. (Ah, one of those functions that I knew in theory existed, but never used.) When GS was discussed, we always encountered it with the form $\vec{a} - \vec{b} (\vec{a}\cdot\vec{b})$, and it wasn't until I made a concerted study of vector spaces in physics that a lot of things fell into place. I think a serious advantage of bra-kets is the ability to instantly grasp what is being discussed by it structure on the page. Obviously, you eventually have to resort to other schemes (raised and lowered indices) to deal with more complex issues, but I digress. $\endgroup$ – rcollyer Jul 24 '15 at 13:13

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.