Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
What are vectors?
Vector operations
10. Arithmetic with vectors: multiplication and division
Indexing and filtering


Excellent! Of course, we can also perform multiplication and division between vectors. As with addition and subtraction, multiplication and division are performed in a memberwise fashion.

Let's take a look at an example. The multipliers with which bonuses are calculated for employees of Department 1 are stored in the vector named multipliers_dep_1. The salaries for employees of Department 1 are stored in salaries_dep_1.

Let's calculate the bonus amount for each employee of Department 1 using vector multiplication, like so:

salaries_dep_1 * multipliers_dep_1

The multiplication will proceed as follows:

  salaries_dep_1     3400  2800  5600  4200 
* multipliers_dep_1  0.12  0.29  0.11  0.05 
=                     408   812   616   210


The Versico management has decided to give bonuses next year based on predefined multipliers that are stored in the vector bonus_multipliers. For each employee, the bonus will be calculated as their monthly salary multiplied by their corresponding bonus multiplier. Calculate the salaries after the bonuses are applied.

Recall that monthly salaries are stored in the vector called salaries.