This is a new version of my answer in response to the edited question (the first version is here).
It is based on the same idea, but the Weierstrass substitution rules are now generated by Mathematica (instead of entered by hand) and results with $\pm$ solutions are correctly returned.
First, generate the Weierstrass substitution rules
$TrigFns = {Sin, Cos, Tan, Csc, Sec, Cot};
(WRules = $TrigFns == (Through[$TrigFns[x]] /. x -> 2 ArcTan[t] //
TrigExpand // Together) // Thread)
Then, Partition[WRules /. Thread[$TrigFns -> Through[$TrigFns[x]]], 2] // TeXForm returns
$$
\begin{align}
\sin (x)&=\frac{2 t}{t^2+1}\,, & \cos (x)&=\frac{1-t^2}{t^2+1}\,, \\
\tan (x)&=-\frac{2 t}{t^2-1}\,, & \csc (x)&=\frac{t^2+1}{2 t}\,, \\
\sec (x)&=\frac{-t^2-1}{t^2-1}\,, & \cot (x)&=\frac{1-t^2}{2 t} \ .
\end{align}
$$
Then, we invert the rules using
invWRules = #[[1]] -> Solve[#, t, Reals] & /@ WRules
which we can finally use in the convert function:
convert[expr_, (trig : Alternatives@@$TrigFns)[x_]] :=
Block[{temp, t},
temp = expr /. x -> 2 ArcTan[t] // TrigExpand // Factor;
temp = temp /. (trig /. invWRules) // FullSimplify // Union;
Or @@ temp /. trig -> HoldForm[trig][x] /. ConditionalExpression -> (#1 &)]
Note that the final line has HoldForm to prevent things like 1/Sin[x] automatically being rewritten as Csc[x], etc...
Here are some test cases - it is straight forward to check that the answers are correct (but don't forget to use RelaseHold):
In[6]:= convert[Sin[x], Cos[x]]
Out[6]= - Sqrt[1 - Cos[x]^2] || Sqrt[1 - Cos[x]^2]
In[7]:= convert[Sin[x]Cos[x], Tan[x]]
Out[7]= Tan[x]/(1 + Tan[x]^2)
In[8]:= convert[Sin[x]Cos[x], Cos[x]]
Out[8]= -Cos[x] Sqrt[1 - Cos[x]^2] || Cos[x] Sqrt[1 - Cos[x]^2]
In[9]:= convert[Sin[2x]Cos[x], Sin[x]]
Out[9]= -2 Sin[x] (-1 + Sin[x]^2)
In[10]:= convert[Sin[2x]Tan[x]^3, Cos[x]]
Out[10]= 2 (-2 + 1/Cos[x]^2 + Cos[x]^2)
A couple of quick thoughts about the above solution:
It assumes real arguments for the trig functions. It would be nice if it didn't do this and could be extended to hyperbolic trig and exponential functions.
When two solutions are given, it should return the domains of validity - or combine the appropriate terms using Abs[].
It should be extended to handle things like convert[Sin[x], Cos[2x]].
If anyone feels like implementing any of these things, please feel free!
covertutility, but I am still not sure. Maple has aconvertfunction, which is really a nice one actually, I never understood why Mathematica does not have such a super function, may be because one can do most of these things using patterns in Mathematica? not sure, but here is a link for one example to convert a trig to tan, maplesoft.com/support/help/Maple/view.aspx?path=convert%2ftan . the convert function does much more that this one case. Is this sort of what you are thinking about? – Nasser Jan 21 '12 at 11:45Sin[x]only equalsSqrt[1-Cos[x]^2]for half of its period. Are you sure that is the answer you want? – Simon Jan 21 '12 at 11:46