3
$\begingroup$

I have a trignometric solution of the form,

$A Cos(x) + B Sin(x)$

I want to make it into something of the form,

$C Sin(x + \delta)$

Where $C$ and $\delta$ are given in terms of A and B

$\endgroup$
1

3 Answers 3

1
$\begingroup$
expr1 = a Cos[x] + b Sin[x];

expr2 = c Sin[x + d];

expr3 = expr2 // TrigExpand

(*  c Cos[x] Sin[d] + c Cos[d] Sin[x]  *)

Equating coefficients and requiring a != 0, c and d are given by

sol = Solve[{a == Coefficient[expr3, Cos[x]],
     b == Coefficient[expr3, Sin[x]], a != 0}, {c, d}, Reals] /. C[1] -> 0 // 
  Simplify

(*  {{c -> -a Csc[2 ArcTan[b/a + Sqrt[1 + b^2/a^2]]], 
  d -> -2 ArcTan[b/a + Sqrt[1 + b^2/a^2]]}, {c -> -a Csc[
     2 ArcTan[b/a - Sqrt[1 + b^2/a^2]]], 
  d -> -2 ArcTan[b/a - Sqrt[1 + b^2/a^2]]}}  *)

expr2 is then

expr2 /. sol

(*  {-a Csc[2 ArcTan[b/a + Sqrt[1 + b^2/a^2]]] Sin[
   x - 2 ArcTan[b/a + Sqrt[1 + b^2/a^2]]], -a Csc[
   2 ArcTan[b/a - Sqrt[1 + b^2/a^2]]] Sin[
   x - 2 ArcTan[b/a - Sqrt[1 + b^2/a^2]]]}  *)

Each simplifies to expr1

% // FullSimplify

(*  {a Cos[x] + b Sin[x], a Cos[x] + b Sin[x]}  *)
$\endgroup$
4
$\begingroup$

There are special Trig functions that attempt to do these kinds of transformations:

TrigExpand[c Sin[x + d]]
c Cos[x] Sin[d] + c Cos[d] Sin[x]

TrigReduce[c Cos[x] Sin[d] + c Cos[d] Sin[x]]
c Sin[d + x]

For the particular form you requested, you'll want to collect the coefficients with the same trig functions

red = TrigReduce[a Cos[x] Sin[d] + b Cos[d] Sin[x]]
Collect[red, {Sin[d - x], Sin[d + x]}]
1/2 (a - b) Sin[d - x] + 1/2 (a + b) Sin[d + x]
$\endgroup$
1
$\begingroup$

Mathematica seems to have difficulties to get to your form, as it is only valid for real values, and MMA generally doesn't like equations over Reals as much as those over Complexes.

Anyway, the solution is $\sqrt{A^2+B^2}\sin(x+\arctan(b,a))$: (if someone manages to get MMA to find this "on its own", I'd be very interested)

In[1]:= TrigExpand[Sqrt[A^2 + B^2] Sin[x + ArcTan[B, A]]]
Out[1]= A Cos[x] + B Sin[x]
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.