# zeros() Function & Examples

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

## zeros

#### zeros(m)

#### zeros(m, n)

#### zeros(m, n, p, ...)

#### zeros([m])

#### zeros([m, n])

#### zeros([m, n, p, ...])

Try it yourself:

```calculio
zeros(3)
zeros(3, 5)
a = [1, 2, 3; 4, 5, 6]
zeros(size(a))
```

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

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

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

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

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

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

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

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

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

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

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

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

---

## Create zero-filled arrays and matrices

**zeros** creates an array or matrix whose entries are all zero. It is a convenient starting point for accumulators, masks, coefficient tables, and linear-algebra calculations where every value will later be filled or updated.

## Examples and alternatives

Use a single dimension to create a zero vector, or multiple dimensions to create a rectangular matrix. Check the result with [size](https://calcul.io/function/size/index.md) before combining it with another matrix. [ones](https://calcul.io/function/ones/index.md) creates the corresponding all-one matrix, while [identity](https://calcul.io/function/identity/index.md) creates a square matrix with ones only on its diagonal.

## Practical use

A zero matrix can represent an initial sum of matrix contributions. Build or update compatible values with [add](https://calcul.io/function/add/index.md), and use [matrixFromFunction](https://calcul.io/function/matrixFromFunction/index.md) when entries follow a known index-based rule from the start. Zero initialization should not be used as a missing-data marker unless zero is impossible in the domain.

## Input caveats

Dimensions should be non-negative integers. Large dimensions consume memory quickly, so create only the shape required. A zero matrix has numeric zero entries; it is not an empty collection. Use [count](https://calcul.io/function/count/index.md) when you need the number of entries rather than a matrix of them.

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