# dot() Function & Examples

Use the dot() matrix function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## dot

#### dot(A, B)

#### A * B

Try it yourself:

```calculio
dot([2, 4, 1], [2, 2, 3])
[2, 4, 1] * [2, 2, 3]
```

[multiply](https://calcul.io/function/multiply/index.md)

[cross](https://calcul.io/function/cross/index.md)

---

## dot(): The Dot Product of Vectors

**dot()** calculates an inner, or dot, product. For vectors it multiplies corresponding entries and adds the results. The dot product connects direction and magnitude, making it fundamental in geometry, projections, graphics, and statistics.

## Angle and projection

For normalized vectors, dot(a, b) equals the cosine of the angle between them. A positive result means similar direction, zero means perpendicular, and a negative result means opposite direction. Use [acos()](https://calcul.io/function/acos/index.md) to turn a normalized dot product into an angle, and [norm()](https://calcul.io/function/norm/index.md) to find lengths for normalization.

Vectors must have compatible lengths; matrix products additionally require matching inner dimensions. Do not confuse dot with [dotMultiply()](https://calcul.io/function/dotMultiply/index.md), which returns element-wise products, or [multiply()](https://calcul.io/function/multiply/index.md), which performs general multiplication.

## Practical checks

Use [size()](https://calcul.io/function/size/index.md) when dimensions come from data. In floating-point work, a near-zero dot product indicates approximate perpendicularity, not necessarily exact zero.

[All functions](https://calcul.io/functions/index.md)
