# Defining a Vector | Linear Algebra with Python

Linear Algebra with Python | Here, we are going to learn how to define a vector in Python?
Submitted by Anuj Singh, on May 10, 2020

Linear algebra is the branch of mathematics concerning linear equations by using vector spaces and through matrices. In other words, a vector is a matrix in n-dimensional space with only one column. So vector is one of the important constituents for linear algebra. In this tutorial, we will just understand how to represent a vector in python.

In the python code, we printed a random vector and it could be done by using the list of python. Secondly, we defined and printed a zero vector in 4-dimensional space. A zero vector is always denoted by z in linear algebra.

## Python code to define a vector

```# Vector in Linear Algebra

a = [3, 5, -5, 8]
# This is a 4 dimensional vector
# a list in python is a vector in linear algebra

print("Vector a = ", a)
# This is how we can print a vector in python

z = [0, 0, 0, 0]
print("Zero Vector z = ", z)
# This is a zero vector
```

Output

```Vector a =  [3, 5, -5, 8]
Zero Vector z =  [0, 0, 0, 0]
```

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