# cross

cross(x, y) Ã—(x,y)

Compute the cross product of two 3-vectors.

## Examples

In the Julia programming language, the `cross(x, y)` function is used to compute the cross product of two 3-vectors `x` and `y`.

``````julia> cross([1, 0, 0], [0, 1, 0])
3-element Array{Int64,1}:
0
0
1``````

Here are some common examples of how the `cross` function can be used:

1. Compute the cross product of two 3D vectors:

``````julia> v1 = [1, 2, 3];
julia> v2 = [4, 5, 6];
julia> cross(v1, v2)
3-element Array{Int64,1}:
-3
6
-3``````

This example calculates the cross product of `v1` and `v2`, resulting in a new 3-vector.

2. Calculate the surface normal of a triangle:
``````julia> v1 = [1, 0, 0];
julia> v2 = [0, 1, 0];
julia> normal = cross(v1, v2);
julia> normalize(normal)
3-element Array{Float64,1}:
0.0
0.0
1.0``````

Here, the `cross` function is used to find the surface normal of a triangle defined by `v1` and `v2`. The `normalize` function is then applied to obtain a unit normal vector.

Common mistake example:

``````julia> cross([1, 2, 3, 4], [5, 6, 7])
ERROR: MethodError: no method matching cross(::Array{Int64,1}, ::Array{Int64,1})``````

In this example, the input vectors have dimensions that are incompatible for computing the cross product. The `cross` function expects two 3-vectors, so ensure that the input vectors have the correct dimensions to avoid such errors.