# Arithmetic Array Operators

Arithmetic operators on arrays and certain combinations of arrays and scalars are available through the standard arithmetic operators, addition (+), subtraction (-), division (/), multiplication as well as through the exponentiation (^) operator.

Strangely enough, elementwise operations for the combination of an array and a scalar operand are defined for multiplication and division but not for addition and subtraction.

Try interactive:

When we try to simulate AddSub, it does not work since different array sizes are not allowed in Addition operand

Look at results:

## 3 Multiplication

The array multiplication operator is only defined for vectors and matrices and has several different definitions depending on the type of its arguments. If both operands are vectors then array multiplication means scalar product, otherwise, if the operands are vectors or matrices then it means matrix multiplication. If one of the operands is a scalar, then the multiplication operation is defined as elementwise multiplication, which however is not available when both operands are arrays despite the fact that analogous elementwise operations are defined for addition and subtraction. The reason is that we have already used the multiplication notation (*) for the more common operation of matrix multiplication.

## 4 Exponentiation

Array exponentiation is the same as repeated matrix multiplication and is therefore only defined when the first operand is a square matrix and the second operand is a non-negative integer.