# Outer Product of Vectors | Linear Algebra using Python

Linear Algebra using Python | Outer Product of Vectors: Here, we are going to learn about the outer product of vectors and its implementation in Python.
Submitted by Anuj Singh, on June 08, 2020

Prerequisites:

Learn: how to code for outer product of two vectors using am inbuilt function in numpy library?

Syntax:

```numpy.outer(Vec_1, Vec_2)
```

## Python code for outer product of vectors

```# Linear Algebra Learning Sequence
# Outer Product

import numpy as np

a = np.array([2,3,4,1])
b = np.array([5,4,-6,45,7])

outpro = np.outer(a,b)

print('Vector A : ', a)
print('Vector B : ', b)
print('Outer product of Vector A and Vector B :', outpro)
```

Output:

```Vector A :  [2 3 4 1]
Vector B :  [ 5  4 -6 45  7]
Outer product of Vector A and Vector B : [[ 10   8 -12  90  14]
[ 15  12 -18 135  21]
[ 20  16 -24 180  28]
[  5   4  -6  45   7]]
```

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates