2
$\begingroup$

How can one derive programmatically a Cartesian equation when $x$ and $y$ are parametrically represented by trigonometric functions?

i.e.: Given that $x= \cos(2 t)$, and $y = -\sin(t)$, how can I find the Cartesian equation in terms of $x$, and also in terms of $y$?

{
 x == Cos[2 t],
 y == -Sin[t]
}
$\endgroup$
4
  • 1
    $\begingroup$ Hi @wendy, notice how you questions always get edited by other users to provide the necessary code and maths in formatted form and make the questions title and text descriptive and searchable. In the future you can try to do that while you compose your question. See here: mathematica.stackexchange.com/help/on-topic $\endgroup$
    – rhermans
    Aug 2, 2019 at 12:27
  • $\begingroup$ Hi @rhermans , yes, I do notice that my questions always get edited. I'm sorry it always happens, and for burdening you/ those who go through the effort of editing them. Although I always keep in mind I should format it properly, when I post another question, I'm in such a state of panic I don't format it, and I realise once it's posted that I should have. I really apologise. $\endgroup$
    – wendy
    Aug 2, 2019 at 12:39
  • 1
    $\begingroup$ No need to apologize, you are just starting and getting acquainted with the site. Just keep it in mind for the future. You can always edit your question after posting to improve it. By doing all this you help us to help you and likely you will inspire great answers. The site depends on participation, as you receive give back: vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. $\endgroup$
    – rhermans
    Aug 2, 2019 at 12:41
  • $\begingroup$ Duely noted, @rhermans ! Thanks again for answering my question and for editing it $\endgroup$
    – wendy
    Aug 2, 2019 at 12:52

4 Answers 4

5
$\begingroup$

One can use GroebnerBasis[] with some assistance from TrigExpand[]:

GroebnerBasis[{x == Cos[2 t], y == -Sin[t]} // TrigExpand
              // Append[Cos[t]^2 + Sin[t]^2 == 1], {x, y}, {Cos[t], Sin[t]}] // First
   -1 + x + 2 y^2

Check:

% /. Thread[{x, y} -> {Cos[2 t], -Sin[t]}] // Simplify
   0
$\endgroup$
2
  • $\begingroup$ Hello, @J.M., thanks for your contribution. As much as I appreciate your suggestion, I'm confused as to how it works, and would love to know. Could you please explain what a GrobnerBasis is? What is your "Check" step doing? What does the "% /. Thread" mean/do? Many thanks in advance $\endgroup$
    – wendy
    Aug 2, 2019 at 12:48
  • $\begingroup$ Ulrich has already explained the Weierstrass substitution to you. Here, I use GroebnerBasis[] to help me eliminate the terms with Cos[t] and Sin[t] (which is why they are in the third argument), and retain an expression only in terms of x and y. The "check" ensures that the original parametric equations give $0$ when substituted into the resulting implicit Cartesian equation previously (hence the %) produced by GroebnerBasis[]. $\endgroup$ Aug 6, 2019 at 3:30
5
$\begingroup$

If you need to go blindly, then have a look into the documentation of Eliminate, TrigExpandand Solve, and beware of the limitation of InverseFunction when solving into the form $y=f(x)$.

There are other better options (see answers by Ulrich Neumann and J.M) if you know where you are going.

Assuming[
 -1 < x < 1,
 Simplify@Eliminate[
   {
    x == Cos[2 t],
    y == -Sin[t]
    }
   , t
   ]]

(* ArcCos[x] + 2 ArcSin[y] == 0 *)

Assuming[
 0 < x < 1,
 FullSimplify[
  Solve[
   ArcCos[x] + 2 ArcSin[y] == 0
   , y
   ]]]
(* {{y -> -Sin[ArcCos[x]/2]}} *)

or

Eliminate[
 TrigExpand@{
   x == Cos[2 t],
   y == -Sin[t]
   }, t]

(* 2 y^2 == 1 - x *)

And then Solve.

$\endgroup$
5
  • 2
    $\begingroup$ You can help out Eliminate[] by performing a preliminary Weierstrass substitution: Eliminate[TrigExpand[{x == Cos[2 t], y == -Sin[t]} /. t -> 2 ArcTan[u]], u] $\endgroup$ Aug 2, 2019 at 11:54
  • $\begingroup$ Thanks @J.M., good to see you back! $\endgroup$
    – rhermans
    Aug 2, 2019 at 12:28
  • $\begingroup$ Thank you @rhermans ! $\endgroup$
    – wendy
    Aug 2, 2019 at 12:43
  • $\begingroup$ Thanks for your suggestion, @J.M.! Do you mind if you explain what a "Weierstrass substitution" is please? $\endgroup$
    – wendy
    Aug 2, 2019 at 12:44
  • 3
    $\begingroup$ I am always amazed that Eliminate handles transcendentals, even simple ones like this. I was probably a lot smarter when i got it to do that (way back in the last millennium). $\endgroup$ Aug 2, 2019 at 16:08
4
$\begingroup$

The "Weierstrass substitution" gives a direct result

eq = { x == Cos[2 t], y == -Sin[t]} /. t -> 2 ArcTan[u] // TrigExpand
sol = Solve[eq, y, u]
(*{{y -> -(Sqrt[1 - x]/Sqrt[2])}, {y -> Sqrt[1 - x]/Sqrt[2]}}*)

Plot[y /. sol, {x, -1, 1}, Evaluated -> True]

enter image description here

$\endgroup$
9
  • $\begingroup$ Hi, @UlrichNeumann , thanks for your comment. Could you please explain what a "Weierstrass substitution" is? Why did you do it? $\endgroup$
    – wendy
    Aug 2, 2019 at 12:45
  • 1
    $\begingroup$ @wendy It is the simple transformation u->Tan[t/2]<=> t->2 ArcTan[u] which transforms your trigonometric equations into rational equations in u, which might be solved easier. Additionally you restrict the solution to Pi <t<Pi $\endgroup$ Aug 2, 2019 at 12:56
  • 2
    $\begingroup$ Because you avoid Sqrt and u=Tan[t/2] transforms one period -Pi<t<Pi to -Infinity<u<Infinity $\endgroup$ Aug 4, 2019 at 12:35
  • 1
    $\begingroup$ Sqrt =squarerootfunction. $\endgroup$ Aug 4, 2019 at 13:07
  • 1
    $\begingroup$ Try it yourself {Sin[t], Cos[t], Tan[t]} /. t -> 2 ArcTan[u] // TrigExpand // Simplify $\endgroup$ Aug 4, 2019 at 13:08
2
$\begingroup$

If you want to avoid inverse functions then you need to use trig identities to eliminate the parameter (if that is possible). For the example that you give,

x == Cos[2t] //TrigExpand
% /. Cos[t]^2 -> 1 - Sin[t]^2
% /. Sin[t] -> -y

(*  x == 1 - 2 y^2  *)

so the curve is part of a parabola on its side,

ParametricPlot[Evaluate[{x, y} /. {x -> Cos[2 t], y -> -Sin[t]}], {t, 0, 10}]

More generally, one would have to proceed as in @rhermans answer.

$\endgroup$
2
  • $\begingroup$ I'm very grateful for your comment, @AndrewNotron. Thank you. Do you mind if you please explain what the second line onwards means/ does? Thank you $\endgroup$
    – wendy
    Aug 2, 2019 at 12:59
  • 1
    $\begingroup$ % is the last Output result, /. is infix form of ReplaceAll, -> is infix form of Rule. To find out this sort of thing, highlight the %, /., or -> with the mouse and then press the F1 key to get the documentation. $\endgroup$ Aug 3, 2019 at 1:46

Your Answer

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

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