If I use TrigFactor, it gives the result in terms of Sin:
In[483]:=
expr := Cos[x] + Sin[x]
TrigFactor[expr]
Out[485]=Sqrt[2]*Sin[Pi/4 + x]
What I want to get is
Sqrt[2]*Cos[-Pi/4 + x]
Using ReplaceAll doesn't help, since it does the replacement, but then converts back to Sin.
In[489]:=
expr := Cos[x] + Sin[x]
TrigFactor[expr] /. Sin[t_] -> Cos[t - Pi/2]
Out[490]=Sqrt[2] Sin[Pi/4 + x]
TrigFactor[expr] /. Sin[Pi/4 + t_] -> HoldForm@Cos[t - Pi/4]– Daniel Huber Nov 28 '21 at 17:20(((expr // TrigFactor) /. Sin[x_] :> Inactive[Cos][x - Pi/2]) // Activate) /. Cos[x_] :> Cos[-x]The last replacement is not necessary if you are satisfied with the negative of the desired argument. – Bob Hanlon Nov 28 '21 at 17:57