---
layout: default
---
Function atan2 #
Calculate the inverse tangent function with two arguments, y/x.
By providing two arguments, the right quadrant of the computed angle can be
determined.
For matrices, the function is evaluated element wise.
Syntax #
```js
math.atan2(y, x)
```
Parameters #
Parameter | Type | Description
--------- | ---- | -----------
`y` | number | Array | Matrix | Second dimension
`x` | number | Array | Matrix | First dimension
Returns #
Type | Description
---- | -----------
number | Array | Matrix | Four-quadrant inverse tangent
Throws #
Type | Description
---- | -----------
Examples #
```js
math.atan2(2, 2) / math.pi // returns number 0.25
const angle = math.unit(60, 'deg')
const x = math.cos(angle)
const y = math.sin(angle)
math.atan2(y, x) * 180 / math.pi // returns 60
math.atan(2) // returns number 1.1071487177940904
```
See also #
[tan](tan.html),
[atan](atan.html),
[sin](sin.html),
[cos](cos.html)