# math.acos()

## Parameters

NameTypeDescriptionExpected ValuesDefault Value
xfloatRequired. A number in the range -1 to 1. If x is not a number, it returns a TypeErrorA number in the range -1 to 1.

## Description

Welcome to this comprehensive tutorial about Python’s math.acos() method. This tutorial will cover all the essential aspects of math.acos() including its definition, usecase, and examples with output.

### Definition

In mathematics, the arccosine (or inverse cosine) is the inverse function of the cosine. It is written as ‘cos-1’ or ‘arccos’. The cosine of a number is the ratio of the length of the adjacent side to the hypotenuse of a triangle. In Python, math.acos() method is used to return the arccosine value of a number in radians. The acos() method takes a single argument and returns the arccosine value of x in radians in the range [0, π] radians.

### Usecase

The acos() method is widely used in mathematics and various scientific fields such as computational geometry or trigonometry. It can be used to calculate angles for triangles or to solve equations.

## Examples with Output

Let’s get into some examples of how to use math.acos() method.

### Example 1

#Calculate the arccosine of 0.5

``````import math

x = 0.5

y = math.acos(x)

print(y) ``````

# Output: 1.0471975511965976

### Example 2

Calculate the arccosine of a given number

``````import math

x = float(input('Enter a number: '))

y = math.acos(x)

print(y)``````

#Output: Enter a number: 0.14
1.3947553170960717

### Example 3

Calculate the arccosine of 2 (which will throw an error)

``````import math

x = 2

y = math.acos(x)

print(y)``````

Output: ValueError: math domain error

## Conclusion

In this tutorial, we have discussed Python math.acos() method and its definition, use cases, and examples with output. The math.acos() method takes a single argument which is the value of the angle in radians and returns the arccosine value of x in radians. Additionally, it should be noted that if an argument greater than 1 or less than -1 is used, an error will be thrown.