# Python | sympy.expand_trig() method

With the help of sympy.expand_trig() method, we can expand any trigonometric expression to its lowest form.

Syntax: expand_trig(expression)

Parameters:
expression – It is the trigonometric expression which will be expanded.

Returns: Returns the trigonometric expression after its expansion.

Example #1:

In this example we can see that by using sympy.expand_trig() method, we can expand any trigonometric expression.

 `# import sympy ` `from` `sympy ``import` `*`  ` `  `x ``=` `symbols(``'x'``) ` `exp ``=` `sin(``2` `*` `x) ``+` `cos(``2` `*` `x) ` `print``(``"Before Trigonometric Expansion : {}"``.``format``(exp))  ` `   `  `# Use sympy.expand_trig() method ` `res_exp ``=` `expand_trig(exp)  ` `   `  `print``(``"After Trigonometric Expansion : {}"``.``format``(res_exp))  `

Output:

```
Before Trigonometric Expansion : sin(2*x) + cos(2*x)
After Trigonometric Expansion : 2*sin(x)*cos(x) + 2*cos(x)**2 - 1
```

Example #2:

 `# import sympy ` `from` `sympy ``import` `*`  ` `  `x, y ``=` `symbols(``'x y'``) ` `exp ``=` `cos(``3` `*` `x) ``-` `sin(``3` `*` `y) ` `print``(``"Before Trigonometric Expansion : {}"``.``format``(exp))  ` `   `  `# Use sympy.expand_trig() method ` `res_exp ``=` `expand_trig(exp)  ` `   `  `print``(``"After Trigonometric Expansion : {}"``.``format``(res_exp))  `

Output:

```
Before Trigonometric Expansion : -sin(3*y) + cos(3*x)
After Trigonometric Expansion : 4*sin(y)**3 - 3*sin(y) + 4*cos(x)**3 - 3*cos(x)
```

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.