Can only find one double angle formula of cos(2x).

close all
clear
clc
syms x
expand (cos(2*x))
ans =
2*cos(x)^2 - 1
That is one of the three double angle formulas for cos(2x).
How do I get matlab to show the other two double angle formulas?

 Accepted Answer

Experiment with various options to get at least one more identity —
syms x
f(x) = cos(2*x)
f(x) = 
f1 = expand (f)
f1(x) = 
f2 = rewrite(f, 'exp')
f2(x) = 
f3 = rewrite(f2, 'sin')
f3(x) = 
.

5 Comments

And cos(x)^2 - sin(x)^2 ?
Simple enough, since we can add zero to an identity and have it be still valid...
syms x
f(x) = cos(2*x);
f1 = expand(f)
f1(x) = 
Just adding one identity to another:
f4 = f1 + 1 - sin(x)^2 -cos(x)^2
f4(x) = 
I don't think MATLAB really cares about how many versions of the same identity it can show, since they are all mathematically identical.
Wait, sorry but I don't understand what you're doing to get f4(x) = cos(x)^2-sin(x)^2.
@John Ooi: He adds:
0 = 1 - 1 = 1 - (sin(x)^2 + cos(x)^2) = ...
= 1 - sin(x)^2 - cos(x)^2
@John D'Errico: Yes, Matlab does not care, because all these expressions are equivalent. But I was curious how to bring the symbolic engine to express the different forms. Thanks for showing this.

Sign in to comment.

More Answers (0)

Asked:

on 10 Sep 2021

Commented:

Jan
on 10 Sep 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!