I have recently discovered how to compute vector cross products in the statistical programming language R. The very helpful link was from http://stackoverflow.com/questions/36798301/r-compute-cross-product-of-vectors-physics. The last comment of the link mentions using the pracma package for computing vector cross product.

To install the pracma package in R, you can type in:

1 |
install.packages("pracma") |

After installing the pracma package in R you need to load the pracma package in order to use the cross product function in the package. You can load pracma into R using

1 |
require("pracma") |

or by using

1 |
library(pracma) |

**Example**

Suppose we have the vectors and . The vector which is perpendicular/orthogonal (90 degrees) to both vectors and is the cross product vector. The cross product vector can be determined using the pracma package in R.

1 2 3 4 5 6 7 8 9 10 11 |
# Example: # Finding the cross product of the two vectors # u = (2, 0, -8) and v = (0, 0, 1) u <- c(2, 0, -8) v <- c(0, 0, 1) crossProd1 <- cross(u, v) crossProd1 [1] 0 -2 0 |

We can check (algebraically) that the cross product vector of is orthogonal to vectors and .

1 2 3 4 5 6 7 8 9 |
# Checking that the cross product is perpendicular/orthogonal to # vectors u and v. # If dot product is zero, two vectors are orthogonal (90 degrees) to each other. sum(u * crossProd1) [1] 0 sum(v * crossProd1) [1] 0 |

The cross product vector is valid as both dot products are both zero.