I am trying to convert a trigonometric expression like

sinθ/(1 - cosθ)


cosecθ + cotθ


(1 + cosθ)/sinθ

Basically, I want to change the original expression to something different. However, I am only allowed to use these 7 relations:

sin^2θ + cos^2θ = 1
1 + tan^2θ = sec^2θ
1 + cot^2θ = cosec^2θ
sinθ = 1/cosecθ
cosθ = 1/secθ
tanθ = 1/cotθ
tanθ = sinθ/cosθ

I am not allowed to use any other trigonometric identities besides these seven to transform the expression.

Ideally, I would like to be able to tell Mathematica to take the first expression and change it into another expression which contains only cosecθ and cotθ.

However, if that is not possible, I would like Mathematica to convert the original expression into different variations by only using those 7 identities.

  • 1
    $\begingroup$ In MMA use: Sin[θ] Not sinθ? $\endgroup$ Aug 5, 2018 at 15:31
  • $\begingroup$ @MariuszIwaniuk Thanks for the input. :) Actually, I haven't written anything in MMA yet. I was just stating the problem I am facing here so I didn't use the proper syntax. $\endgroup$ Aug 5, 2018 at 16:11

1 Answer 1


First, as already noted in the comment by Mariusz Iwaniuk, you should learn the correct MMA notation. MMA understands cosecθ as a variable whose name has six letters: c, o, s, e, c, θ. Humans understand that you meant Csc[θ], but MMA is not that advanced.

Second, think of how you would do it by hand. Since you want results containing only Csc[θ] and Cot[θ], you should rewrite your identities so that Csc[θ] and Cot[θ] are in the right hand side. You leave in the left hand side those expression that you want to eliminate. Out of your 7 original identities, I translated 6:

$\sin (θ)=\sqrt{1-\cos ^2(θ)}$

$\tan (θ)=\sqrt{\sec^2(θ)-1}$

$\sin (θ)=\frac{1}{\csc (θ)}$

$\sec (θ)=\frac{1}{\cos(θ)}$

$\tan (θ)=\frac{1}{\cot (θ)}$

$\tan (θ)=\frac{\sin(θ)}{\cos (θ)}$

Your 3rd identity relates cotangent and cosecant. Since you want them both in the answer, there is no point in using it. If you wanted the answer only in terms of say cosecant, then that 3rd identity would be useful to eliminate the cotangent (or viceversa).

Now, blindly replacing identities might not lead you to an expression with only the functions you want. For the particular way of re-writing the identities above, the following graph shows that you might end up with expressions containing Csc[θ]. That is because you can reach the "csc" node using the Sin[θ] == 1 / Csc[θ] and you have no way of it.

enter image description here

Fortunately, we can use MMA to rewrite those rules so that only cosecant and cotangent are in the right hand side. But we will have to prevent MMA to use its internal simplification rules. That is accomplished with the code below:

  1 + tanθ^2 == secθ^2,
  sinθ == 1/cosecθ,
  cosθ == 1/secθ,
  tanθ == 1/cotθ(*,
 {sinθ, cosθ, tanθ, secθ}]

Note that instead of using the correct notation Sin[θ], I have used sinθ. That way, we force MMA to solve a set of algebraic equations where the symbols sinθ, cosθ, etc. are not functions of θ. Also, note that I have commented out 3 equations. Since you want to solve for 4 variables, you only need 4 equations. With practice, you learn which equations to comment out. For now, let us say that you use trial and error. There are two sets of solutions depending on the sign you pick on front of the square root. Using those replacement lists you can cast any trigonometric expression as an expression on cotangents and cosecants.

$\left\{\text{sinθ}\to \frac{1}{\text{cosecθ}},\text{cosθ}\to -\frac{\text{cotθ}}{\sqrt{1+\text{cotθ}^2}},\text{tanθ}\to \frac{1}{\text{cotθ}},\text{secθ}\to -\frac{\sqrt{1+\text{cotθ}^2}}{\text{cotθ}}\right\}$

$\left\{\text{sinθ}\to \frac{1}{\text{cosecθ}},\text{cosθ}\to \frac{\text{cotθ}}{\sqrt{1+\text{cotθ}^2}},\text{tanθ}\to \frac{1}{\text{cotθ}},\text{secθ}\to \frac{\sqrt{1+\text{cotθ}^2}}{\text{cotθ}}\right\}$

At this point you might complain that those replacement lists are not the original identities. But now, we know that we need only four equations and we know how the final replacements should look like. That was the main point of the previous two paragraphs: finding the necessary equations (instead of using all 7 identities).

Repeated replacements of the following rules will yield the answer. Note that we are to use sin instead of Sin so that MMA does not try its built-in simplifications.

rules = {
   sec[x_] :> (Print["rule 2 ", sec[x] -> Sqrt[1 + tan[x]^2]]; Sqrt[1 + tan[x]^2]),
   sin[x_] :> (Print["rule 4 ", sin[x] -> 1/csc[x]]; 1/csc[x]),
   cos[x_] :> (Print["rule 5 ", cos[x] -> 1/sec[x]]; 1/sec[x]),
   tan[x_] :> (Print["rule 6 ", tan[x] -> 1/cot[x]]; 1/cot[x])

For example, if you want to cast (1 + cos[y])/sin[y] you would do

(1 + cos[y])/sin[y] //. rules
  • $\begingroup$ Thank you very much for the detailed explanation Hector. This provided a lot of insights. :) When I run the code in Mathematica, it gives me the following result: (1 + 1/Sqrt[1 + 1/cot[y]^2]) csc[y] instead of the simplified version csc[y] + cot[y]. Is there any way to simplify the answer provided by Mathematica? $\endgroup$ Aug 5, 2018 at 20:24
  • $\begingroup$ @iKnowNothing You asked for an expression in terms of cosecant and cotangent, not for its "simplified version". Getting the "simplified version" of an expression is rather complicated. Basically, you test each transformation and check where it leads to a more simplified form. Proving that those two expressions are equivalent is simple … but there is a reason why Wolfram charges you to give you step-by-step directions. $\endgroup$
    – Hector
    Aug 5, 2018 at 20:54
  • $\begingroup$ Thanks Hector. :) I have accepted as well as upvoted the answer. $\endgroup$ Aug 5, 2018 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.