Element by Element Operations – Division (./)

Element by Element Division

Element by element division (the dot division) ./ works differently from Array multiplication / be careful not to confuse the two.

Division of Scalars

When we looked at subtraction we seen that 6 pens were used. If this is over a period of 3 months, we may want to know the amount of pens used each month so we can make a monthly order. To do this we can use division.

6 pens ./ 3 months = 6/3 pens/month = 2 pens/month

\displaystyle \left[ {6\text{ pens}} \right]./\left[ {\text{3 months}} \right]=\left[ {6\text{ pens}/3\text{ months}} \right]=\left[ {2\text{ pens/month}} \right]

\displaystyle \left[ 6 \right]./\left[ 3 \right]=\left[ {6/3} \right]=\left[ 2 \right]

i.e. we see that 2 pens are used per month.

To write this in MATLAB we would use

6./3

Note for a 1 by 1 scalar array division and element by element division are identical.

(Dot Division) of a Column Vector

If 6 pens and 3 pads were used up in 3 months then

\displaystyle \left[ {\begin{array}{*{20}{c}} {6\text{ pens}} \\ {3\text{ pads}} \end{array}} \right]./\left[ {\begin{array}{*{20}{c}} {3\text{ months}} \\ {3\text{ months}} \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} {6/3\text{ pens/month}} \\ {3/3\text{ pads/month}} \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} {2\text{ pens/month}} \\ {2\text{ pads/month}} \end{array}} \right]

\displaystyle \left[ {\begin{array}{*{20}{c}} 6 \\ 3 \end{array}} \right]./\left[ {\begin{array}{*{20}{c}} 3 \\ 3 \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} {6/3} \\ {3/3} \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} 2 \\ 1 \end{array}} \right]

i.e. we see that 2 pens and 1 pad are used per month.

To write this in MATLAB we would use

[6;3]./[3;3]

(Dot Division) of Matrices

If the man in the red house used 6 pens and 2 pads up in a period of 3 months and the women in the green house used up 8 pens and 6 pads in a period of 4 months then

\displaystyle \left[ {\begin{array}{*{20}{c}} {6\text{ pens}} & {\text{8 pens}} \\ {3\text{ pads}} & {4\text{ pads}} \end{array}} \right]./\left[ {\begin{array}{*{20}{c}} {3\text{ months}} & {4\text{ months}} \\ {3\text{ months}} & {4\text{ months}} \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} {6/3\text{ pens/month}} & {8/4\text{ pens/month}} \\ {3/3\text{ pads/month}} & {4/4\text{ pads/month}} \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} {2\text{ pens/month}} & {2\text{ pens/month}} \\ {1\text{ pads/month}} & {2\text{ pads/month}} \end{array}} \right]

\displaystyle \left[ {\begin{array}{*{20}{c}} 6 & 8 \\ 3 & 4 \end{array}} \right]./\left[ {\begin{array}{*{20}{c}} 3 & 4 \\ 3 & 4 \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} {6/3} & {8/4} \\ {3/3} & {4/4} \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} 2 & 2 \\ 1 & 1 \end{array}} \right]

i.e. we see that the man uses 2 pens and 1 pad per month and the woman also uses 2 pens and 1 pad per month.

To write this in MATLAB we would use

[6,8;3,4]./[3,4;3,4]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.