# Using single replacement rule to convert algebraic expression

I have been trying this problems for hours and cannot find any helpful clues.

How can I convert $Sinh[3\theta]+Sinh[\theta]$ to a rational function of x given $2Sinh[\theta] = x-x^{-1}$ by using only a SINGLE pattern replacement rule. I guess what single means is that we are only allowed to use one arrow.

My question is twofold:
1. I have one method but unsure of its correctness, also although I know the method but I am unable to write the code.
2. If my method is wrong, what is the correct one? This is the best method that I can think of.

My method is as follows:
Since we have the hyperbolic trig formula, we can use the rule (I will use Q instead)

Sinh[a Q] -> (x^a - x^-a)/2


I have tried many ways, and below are the 2 best ones that I think are the closest to the correct answers:

In: f := {Sinh[a Q] + Sinh[Q]} /. Sinh[a Q] -> (x^a - x^-a)/2;
In: {Sinh[3 Q]] + Sinh[Q]} // f


Out: {1/2 (-x^-a + x^a) + Sinh[Q]}[{Sinh[Q] + Sinh[3 Q]}]

In: {Sinh[#1 Q] + Sinh[#2 Q]} /. Sinh[# Q] -> (x^# - x^-#)/2 &[3, 1]


Out: {1/2 (-(1/x^3) + x^3) + Sinh[Q]]}

I always have troubles putting the rules into one entity such that it will replace every coefficient of Q, including 1. The output that I am looking for (using my method) is

Sinh[3Q] + Sinh[Q] = x^3 - x^-3 + x - x^-1


Many thanks.

-
Would TrigToExp[Sinh[3 Q] + Sinh[Q]] /. Exp[a_. Q] -> 2 x^a work ? – b.gatessucks May 18 '13 at 13:18
From your sentence " I guess what single means is that we are only allowed to use one arrow." I infer this is homework. Am I right? – Dr. belisarius May 18 '13 at 15:05
You might find Alternatives to be useful. – whuber May 18 '13 at 15:20
@b.gatessucks Thanks! yes your method works. I have never used TrigToExp before, but I have learned new things now. – user71346 May 19 '13 at 1:46
@belisarius Yes, this is an exercise. – user71346 May 19 '13 at 1:47

Using defaults values _. (for multiplication it is 1) works:
{Sinh[3 Q] + Sinh[Q]} /. Sinh[a_. Q] -> (x^a - x^-a)/2

You should probably use :> to localize a – Simon Woods May 18 '13 at 21:27