# NumPy - hypot() function

The NumPy hypot() function returns the hypotenuse of the right triangle using its legs from the arguments, element-wise. It is equivalent to sqrt(x1**2 + x2**2).

### Syntax

```numpy.hypot(x1, x2, out=None)
```

### Parameters

 `x1, x2` `Required. `Specify legs of the triangle. If x1.shape != x2.shape, they must be broadcastable to a common shape. `out` `Optional. `Specify a location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.

### Return Value

Returns the hypotenuse of the triangle, element-wise.

### Example:

The example below shows the usage of hypot() function.

```import numpy as np
Arr1 = np.array([[3,5],[7,15]])
Arr2 = np.array([[4,12],[24,20]])

print("Arr1 is:")
print(Arr1)

print("\nArr2 is:")
print(Arr2)

#calculating hypotenuse
print("\nHypotenuse is:")
print(np.hypot(Arr1, Arr2))
```

The output of the above code will be:

```Arr1 is:
[[ 3  5]
[ 7 15]]

Arr2 is:
[[ 4 12]
[24 20]]

Hypotenuse is:
[[ 5. 13.]
[25. 25.]]
```

❮ NumPy - Functions

5