Check if two 3D vectors are linearly dependent I would like to determine with code (c++ for example) if two 3D vectors are linearly dependent.
I know that if I could determine that the expression
$ v_1 = k · v_2 $is true then they are linearly dependent; they are linearly independent otherwise.
I've tried to construct an equation system to determine that, but since there could be zeros anywhere it gets very tricky and could end with divisions by zero and similar.
I've also though about using some matrices/determinants, but since the matrix would look like:
$$
\begin{matrix}
x_1 &  y_1 & z_1\\
x_2  &  y_2 & z_2\\
\end{matrix}
$$
i don't see an easy way to check for the the linear dependency... any ideas?
Thanks!

If $x_1/x_2 = y_1/y_2 = z_1/z_2$ then $v_1 = k v_2.$ Care needs to be taken for the zeros though. If any component is zero, then the corresponding component needs to be zero.
