# Conversion of Sine to Cosine

I'm solving equations with many Cosines and Sines. And I want to convert all the Sines to Cosines using trigonometric formulas such as cos(x)=sin(x+pi/2). How can I do this?

• Why you need it? Solve commands in mathematica isn't sensitive to such things. And Mathematica automatically treats sin(x+pi/2) as cos(x) unless you force unevaluated form by Hold[sin(x+pi/2)]. – funnyp0ny Dec 7 '14 at 15:33
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Dec 7 '14 at 15:34
• Is this Question about the Software Mathematica? If so please complement your Question with Code. Else Mathematics satisfies your needs better. – user9660 Dec 7 '14 at 15:34
• @funnypony Thank you. I need it because I am comparing equations solved by hand and by Mathematica. The solutions by hand are all Cosine based, but Mathematica automatically convert some Cosines to Sines. I expected there could be a function in Mathematica that converts all Sines to Cosines. I think that "Hold" can't be used in my case because I want to convert the Sines after the evaluation of the equations. – YongCheol Kwon Dec 8 '14 at 2:25

The main problem here is that Mathematica immediately converts terms such as Sin[x+π/2] to the more simpler Cos[x]. You have to prevent this from occurring. You could do that with Defer or in V10 with Inactivate:

Inactivate[
Cos[p x + 2] Sin[z a + q] + Cos[x]^2/(Sin[a + b] - Cos[2 n]) /. Cos[x_] :> Sin[x + π/2],
Sin
]


or, perhaps better (per comment of Bob Hanlon):

Cos[p*x + 2]*Sin[z*a + q] + Cos[x]^2/(Sin[a + b] - Cos[2*n]) /. Cos[x_] :> Inactive[Sin][x + Pi/2]


(note that the inactive sines are printed in a gray style).

• Or you can use Cos[p*x + 2]*Sin[z*a + q] + Cos[x]^2/(Sin[a + b] - Cos[2*n]) /. Cos[x_] :> Inactive[Sin][x + Pi/2] which leaves the original Sin functions active. – Bob Hanlon Dec 7 '14 at 17:43
• @BobHanlon That may be better indeed if the OP wants to do something with them (though I don't have a clue what that might be) – Sjoerd C. de Vries Dec 7 '14 at 18:27
• @BobHanlon Thank you for your answer. Your code doesn't work in my PC since I'm using V9. And I don't understand the syntax. Maybe I need more study in Mathematica. – YongCheol Kwon Dec 8 '14 at 2:31
• With v9 you cannot use Inactive or Inactivate but as mentioned by @Sjoerd you can use Defer, i.e., expr = Cos[p*x + 2]*Sin[z*a + q] + Cos[x]^2/(Sin[a + b] - Cos[2*n]) /. Cos[x_] :> Defer[Sin][x + Pi/2]. To release the Defer you can use expr /. Defer -> Identity – Bob Hanlon Dec 8 '14 at 5:12