# numpy numpy.cross

## Syntax

• `numpy.cross(a, b)` # cross product of a and b (or vectors in a and b)
• `numpy.cross(a, b, axisa=-1)` #cross product of vectors in a with b, s.t. vectors in a are laid out along axis axisa
• `numpy.cross(a, b, axisa=-1, axisb=-1, axisc=-1)` # cross products of vectors in a and b, output vectors laid out along axis specified by axisc
• `numpy.cross(a, b, axis=None)` # cross products of vectors in a and b, vectors in a, b, and in output laid out along axis axis

## Parameters

ColumnColumn
a,bIn simplest usage, `a` and `b` are two 2- or 3-element vectors. They can also be arrays of vectors (i.e. two-dimensional matrices). If `a` is an array and 'b' is a vector, `cross(a,b)` returns an array whose elements are the cross products of each vector in `a` with the vector `b`. The `b` is an array and `a` is a single vector, `cross(a,b)` returns an array whose elements are the cross products of `a` with each vector in `b`. `a` and `b` can both be arrays if they have the same shape. In this case, `cross(a,b)` returns `cross(a,b), cross(a, b), ...`
axisa/bIf `a` is an array, it can have vectors laid out across the most quickly varying axis, the slowest varying axis, or something in between. `axisa` tells `cross()` how the vectors are laid out in `a`. By default, it takes the value of the most slowly varying axis. `axisb` works the same with input `b`. If the output of `cross()` is going to be an array, the output vectors can be laid out different array axes; `axisc` tells `cross` how to lay out the vectors in its output array. By default, `axisc` indicates the most slowly varying axis.
axisA convenience parameter that sets `axisa`, `axisb`, and `axisc` all to the same value if desired. If `axis` and any of the other parameters are present in the call, the value of `axis` will override the other values.