%% Cross Product of Vectors
% Create two 3-D vectors.

A = [4 -2 1];
B = [1 -1 3];

%
% Find the cross product of A and B. The result, C, is a vector that is perpendicular to both A and B.

C = cross(A,B)

%
% Use dot products to verify that C is perpendicular to A and B.

dot(C,A)==0 & dot(C,B)==0

% The result is logical 1 (true).
% Copyright 2012 The MathWorks, Inc.