# SIN() and COS() Function in MySQL

• Last Updated : 28 Sep, 2020

1. SIN() Function :
SIN() function in MySQL is used to return the sine of any given number X, where X is given in radians.

Syntax :

`SIN(X)`

Parameter : Required.
X : A number whose sine value we want to calculate. It is given in radian.
Returns : It returns the sine of given number x.

Example-1 :
Sine of 0 using SIN() function.

`SELECT SIN(0) AS Sin_Val;`

Output :

Sin_Val
0

Example-2 :
Sine of 90 degree i.e 1.5707963267948966 radian using SIN() function.

`SELECT SIN(1.5707963267948966) AS Sin_Val;`

Output :

Sin_Val
1

Example-3 :
Sine of -90 degree i.e -1.5707963267948966 radian using SIN() function.

`SELECT SIN(-1.5707963267948966) AS Sin_Val;`

Output :

Sin_Val
-1

Example-4 :
Sine value of a numeric column in a table.

Table – Number

X
-1.22
-0.5
0
0.54
1.55
```SELECT X, SIN(X) AS Sin_X
FROM Number;```

Output :

XSin_X
-1.22-0.9390993563190676
-0.5-0.479425538604203
00
0.540.5141359916531132
1.550.999783764189357

2. COS() Function :
COS() function in MySQL is used to return the cosine of any given number X, where X is given in radians.

Syntax :

`COS(X)`

Parameter : Required.
X : A number whose co-sine value we want to calculate. It is given in radian.
Returns : It returns the cosine of given number x.

Example-1 :
Co-Sine of 0 using COS() function.

`SELECT COS(0) AS  Cos_Val;`

Output :

Cos_Val
1

Example-2 :
Co-Sine of 90 degree i.e 1.5707963267948966 radian using COS() function.

`SELECT COS(1.5707963267948966) AS  Cos_Val;`

Output :

Cos_Val
0

Example-3 :
Co-Sine value of a numeric column in a table.

Table – Number

X
-1.22
-0.5
0
0.25
1.55
```SELECT X, COS(X) AS Cos_X
FROM Number;```

Output :

XCos_X
-1.220.34364574631604705
-0.50.8775825618903728
01
0.250.9689124217106447
1.550.020794827803092428
My Personal Notes arrow_drop_up