# Division of a vector by a scalar number in Matlab and Octave

To divide a vector by a scalar number in Matlab / Octave use the division arithmetic operator

**v/n**

The term v is a vector while the term n is a scalar number.

This operation generates another vector quantity.

$$ \frac{ \vec{v} }{n} = \begin{pmatrix} a_1 \\ a_2 \\ a_3 \end{pmatrix} \cdot \frac{1}{n} = \begin{pmatrix} \frac{a_1}{n} \\ \frac{a_2}{n} \\ \frac{a_3}{n} \end{pmatrix} $$

Each element of the vector v is divided by the scalar number n.

## Example

Define a vector

>> v=[2;4;6]

v =

2

4

6

Divide the vector by the scalar number n = 2

>> v/2

ans =

1

2

3

The output result is another vector.

The elements of the vector are divided by two.

$$ \frac{ \vec{v} }{2} = \frac{1}{2} \cdot \begin{pmatrix} 2 \\ 4 \\ 6 \end{pmatrix} = \begin{pmatrix} \frac{2}{2} \\ \frac{4}{2} \\ \frac{6}{2} \end{pmatrix} = \begin{pmatrix} 1 \\ 2 \\ 3 \end{pmatrix} $$

**Report us an error or send a suggestion to improve this page**