Learning machine learning? Try my machine learning flashcards or Machine Learning with Python Cookbook.

# Calculate Dot Product Of Two Vectors

## Preliminaries

```
# Load library
import numpy as np
```

## Create Two Vectors

```
# Create two vectors
vector_a = np.array([1,2,3])
vector_b = np.array([4,5,6])
```

## Calculate Dot Product (Method 1)

```
# Calculate dot product
np.dot(vector_a, vector_b)
```

```
32
```

## Calculate Dot Product (Method 2)

```
# Calculate dot product
vector_a @ vector_b
```

```
32
```

#### Find an error or bug?

Everything on this site is available on GitHub. Head to and submit a suggested change. You can also message me directly on Twitter.