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[α - β]

2 Answers 2


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

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

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

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.


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.