# Find square root of negative number using python

## 📋 Table Of Content

In this article, we will learn how to find the square root of a negative number using python.

To find the square root of a negative number we have to use complex numbers. In python, we have the `cmath`

that provides us with various mathematical functions to work with complex numbers.

## Square root of a negative number in Python

To work with complex numbers we can use the `cmath`

library of python. And to get the square of a **negative number** we can use the `cmath.sqrt()`

method from cmath library.

**Example:**

```
import cmath
number = -5
negative_sq_val = cmath.sqrt(number)
print(negative_sq_val)
```

**Output:**

```
2.23606797749979j
```

Here, in this example, we have imported the cmath module and then passed the negative number to the `sqrt()`

method.

The `cmath.sqrt()`

method performs the mathematical operations to find the square root and returns the number.

**Other Articles You'll Also Like:**

### Recent Post

- Line continuation | Long statement in Multiple lines in Python
- Find Length of Dictionary in Python with Examples
- Reverse an Array in Python (Using Numpy And Array Module)
- Python import from parent directory
- How to use Pi in Python? (math and numpy module)
- FileNotFoundError: No such file or directory Error Python