In the math and **sciences**, an **array** is a set or an arrangement of items. Arrays are usually sets of numbers or objects, and they are typically organized in columns, rows, or a matrix. Arrays are frequently used to illustrate the principles of division and medication.

An array is simply a data structure, any data structure. Arrays contain points of data, and these points of data can be arranged into rows or columns.

Examples of array organization and manipulation can be seen around us in everyday life. For instance, consider how candies or chocolates can be arrayed in a box of chocolates, or think about eggs organized in an egg carton, or think about board games like chess and the chessboard that organizes pieces. In the example of the box of chocolates, a box of chocolates might contain 12 rows and eight columns, that is to say, chocolates arranged in a fashion that is 12 across and eight down.

To save time figuring out how many chocolates there are, instead of counting every one of them, you just have to multiply 8 x 12, to figure that there are 96 chocolates in the box. The array in this example can be any column, row, the entire box, or any subset of the chocolates. Arrays are simply sets of items. You could also have an array that is simply 1 x 2 or 1 x 3. The array could be 3 x1 or 3 x 3, or 4 x 3. When an array is divided into rows and columns, every row or every column must have the same number of items as the other column or row.

However, the key thing to understand is that doing math with arrays can be much easier and simpler than manipulating each item individually, allowing for the quick multiplication or division of large quantities of items.

**Table Of Contents**show

## Describing Multiplication With Arrays

When describing arrays being multiplied together, it is common practice to reference the arrays by the factors which are being multiplied together. For instance, a 4 x 4 array would describe an array that has 16 items in it, with four rows and four columns. This type of array multiplication is usually taught to elementary school students, and the computation is made more understandable by breaking the multiplication operations down into simpler steps, adding large sums together multiple times.

For instance, if one had an 8 x 8 array, then there are 64 items in the array in total and the number of items can be understood quickly not by adding the rows or columns of a together and counting the individual items, but by multiplying eight by eight.

## Describing Division With Arrays

Just as using arrays can make learning and manipulating items simpler by allowing multiplication, arrays can be used to divide large numbers of items as well. Arrays can help people visualize how items are divided into small groups of equal sizes. As an example, if there are 36 oranges in a crate, the large sum can be divided into groups of equal size and a 6 x 6 grid or array created.

Dividing to create arrays out of a specific number of items demonstrates the commutative property of multiplication. For example, 36 chocolates could be divided as either a 3 x 12 array or a 12 x 3 array. The order of the factors in multiplication doesn’t affect the product when multiplying the factors, and similarly, the number of items in an entire section can be divided into different arrays without affecting the total number of items.

## Matrices

A matrix, the plural of which is matrices, is a rectangular array. Essentially, when you have multiple arrays, they can be laid out as a matrix. Rows and columns of arrays create a matrix, and a matrix with R rows and S columns is referred to as a R x S matrix. R and S are the matrix dimensions. Individual items in a matrix are called elements, and a vector refers to a matrix with only a single row or column. For instance, a column vector describes the matrix with just one column while a row vector is a matrix that has only one row. Square matrices have the exact same number of columns and rows.

Much as arrays can be multiplied and divided, mathematical operations like addition, subtraction, and multiplication can be carried out on matrices. Matrix multiplication can be used to calculate sums. For instance, assume that there is a soda that is sold in either bottle or can form and in the three different flavors: grape, orange, and strawberry. This could be represented with a 2 x 3 matrix. The total number of sales for each element and each type of flavor can be represented in a matrix as well.

Matrices can be added and subtracted together. However, the entered number of entries must correspond with one another. You can only subtract matrices when the same dimensions are present in both matrices. For instance, an ABC matrix can be added together with a DEF matrix, because the dimensions of the matrix are the same, one by three. In the case of addition and subtraction, element one in matrix one is added to element one in matrix two, element two in matrix one is added to element two in matrix two, and element three in matrix one is added to element three in matrix three. So adding matrix ABC together with DEF would be done give a 1 x 3 matrix with the following: (A + D) (B + E) (C + F)

While matrices can be added and subtracted, they can also be multiplied together. The process for multiplying matrices together is a little more complicated than adding or subtracting matrices, however. When you multiply matrices together, the columns found in the second matrix are multiplied together with the corresponding rows found in the first matrix. If matrix A is a D by E matrix and matrix B is an F by G matrix, the results of multiplying matrices A and B together will be defined as D multiplied by G if the number of columns found in matrix A is the same as the number of rows located in matrix B. There must be the same number of columns and rows to multiply together in order for the matrices to be multiplied.

Scalar multiplication refers to the process of multiplying one value by every value found in every element of a matrix. This is different from matrix multiplication because matrix multiplication is multiplying the elements within each row of the first matrix by the elements within each column of the second matrix. When you multiply matrices together, you will be multiplying all the elements found within the first matrix’s rows with the columns that correspond with them in the second matrix. The matrix that results from the multiplication of the two matrices together will have each of its elements computed one at a time in this fashion.

## What Is A Tensor?

Tensors are data containers, containing mostly numbers, though they can sometimes contain strings. Tensors are frequently used in computer science and machine learning. If arrays are single columns or rows of numbers, and matrices are made out of columns and rows (a two-dimensional container for numbers) than tensors can be a three-dimensional (or more) containers for numbers.

A grid of numbers is made out of columns and rows, and the rows and columns each represent two axes. Tensors are useful because they allow you to store multiple grids or two-dimensional matrices in their own bucket, so to speak. Think of a tensor as a cube full of numbers, made out of many grids/matrices layered on top of one another. Tensors are mathematical representations of entities which have not only magnitude but multiple directions, instead of just one direction. Tensors can theoretically get infinitely large, envision stacking cubes made out of grids/matrices together to create larger and larger tensors. You can have a fourth-dimensional tensor, a fifth-dimensional tensor, and so on all the way up to N, N being the representation for an unknown number of units within the set.

**Summing Up:**

Let’s quickly go through the various types of arrays.

The smallest set you can have is a single item or a single data point. After this, there are vectors. Vectors are a single column or row of numbers. Vectors could also be thought of as a one-dimensional array, having magnitude and a single direction. A matrix is a two-dimensional array. The shape of the matrix or array is defined by the two dimensions that comprise it, with an X value and a Y value. For instance, a list of people and accompanying information about these people 5000 instances long would be a 5000 by 6 array if there were six possible information features about a person. Finally, tensors are N-dimensional arrays, with a vector being a one-dimensional tensor, a matrix being a two-dimensional tensor, and beyond this, there are tensors with any given number of dimensions.