# How can expanding trigonometric function retain an expression?

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


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

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

(* Cos[α - β]/Sqrt[2] + Sin[α - β]/Sqrt[2] *)

• Or Sin[π/4 + α - β] // TrigExpand // Simplify 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.