3
$\begingroup$

I want to expand this trigonometric function

Sin[π/4 + α - β]

such that $\alpha - \beta$ is treated as "one" expression, resulting in

Sqrt[2]/2 Cos[α - β] + Sqrt[2]/2 Sin[α - β]
$\endgroup$

2 Answers 2

5
$\begingroup$

Temporary replace α - β with some other dummy symbol, for example αβ, then replace back after TrigExpand.

(Sin[π/4 + α - β] /. α - β -> αβ // TrigExpand) /. αβ -> α - β

(* Cos[α - β]/Sqrt[2] + Sin[α - β]/Sqrt[2] *)
$\endgroup$
1
  • 1
    $\begingroup$ Or Sin[π/4 + α - β] // TrigExpand // Simplify $\endgroup$
    – Bob Hanlon
    May 3, 2023 at 14:29
3
$\begingroup$

This is such a common problem, that it is worth knowing more than one way of doing it. I always try to make the LHS of replacement rules as simple as possible, and to make the replacement obviously correct.

Sin[Pi/4 + a - b] /. a -> HoldForm[a - b] + b // TrigExpand
(*Cos[HoldForm[a - b]]/Sqrt[2] + Sin[HoldForm[a - b]]/Sqrt[2]*)

The HoldForm is typically hidden, and can be eliminated with ReleaseHold when you no longer need the terms to be treated as a unit.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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