# Linear Algebra for Data Science — Vectors

## Basic vector concepts used in data science and machine learning

--

# About the Author

**Benjamin O. Tayo** is a data science educator, tutor, coach, mentor, and consultant. Contact me for more information about our services and pricing: benjaminobi@gmail.com

Dr. Tayo has written close to 300 articles and tutorials in data science for educating the general public. Support Dr. Tayo’s educational mission using the links below:

**PayPal**: https://www.paypal.me/BenjaminTayo

**CashApp**: https://cash.app/$BenjaminTayo

# INTRODUCTION

After going through this article, the reader should learn the following:

- Definition of Vectors
- Perform addition and subtraction of vectors
- Perform scalar multiplication of vectors
- Use scalar multiplication for feature engineering
- Define dot product of vectors
- Use dot products to calculate correlation coefficient

To learn more about the use of matrices in data science and machine learning, see the article below:

# Vectors

A vector is a one-dimensional collection of elements. The dimension of a vector *n *gives number of elements in the vector.

## Addition and Subtraction of Vectors

Two vectors having same dimension can be added and subtracted.

Let vectors ** A** and

**be given as shown below:**

*B*Then the sum of ** A** and

**is given as**

*B*## Scalar Multiplication of Vectors

Let *c* be a real number, then *c*** A **is the vector given by