# Solving simuntaneous equations with elimination of a variable [closed]

I have the following relations:

Dc == k*t0^2
Dp == k*t1^2


I know that I can do the following:

$$\qquad \frac{D_c}{k\space t_0^2}==1 \quad \frac{D_p}{k\space t_1^2}==1 \quad \frac{D_c}{k\space t_0^2}==\frac{D_p}{k\space t_1^2} \quad D_c==\frac{t_0^2}{t_1^2}D_p$$

How can I tell Mathematica to do the same thing? That is, given two equations, how do I coerce Mathematica to come up with a value of $$D_c$$?

• eqns = {Dc == k*t0^2, Dp == k*t1^2}; sol = Solve[eqns, Dc, {k}][[1]] May 25, 2020 at 22:06
• @BobHanlon - Your solution appears to work, but I can't explain how. I tried Solve, but with just two parameters. The third parameter is the domain. How is ${\alpha}$ a domain? If you post this as an answer, I'll up-vote it. May 25, 2020 at 23:13
• Solve accepts an optional argument to designate variable(s) to be eliminated. This argument must be a List even with a single variable so that the argument is not interpreted as an attempt to specify a domain. The number of variables to solve for plus the number of variables to be eliminated must equal the number of equations. In this case with two equations, you must either solve for two variables or solve for one variable and eliminate one variable. May 25, 2020 at 23:44
• I was unaware of that feature of the Solve function as it doesn't appear in the help. This is my favorite answer as it seems to be the most direct. May 26, 2020 at 0:13
• Yes, that feature of Solve[] used to be documented; now it isn't. May 26, 2020 at 15:18

Strictly speaking you are eliminating $$k$$ and you don't need Solve. This is what Eliminate is for and it will also generate conditions on $$t_0,t_1$$:

Eliminate[{Dc == k*t0^2 , Dp == k*t1^2, Dc/(k t0 ^2) == Dp/(k t1^2)}, k]

(* Dc == (Dp t0^2)/t1^2 && t0 != 0 && t1 != 0 *)

• How am I supposed to extract the answer from that? My eyes can see it, but how do I tell a program to extract just the ratio of $\frac{t0^2}{t1^2}$ from that? May 25, 2020 at 23:31
• You didn't express that's what you wanted in the original question, but in that case John Doty's answer handles this. You would use Replace. May 26, 2020 at 10:58

You apparently want to eliminate k and solve for Dc, so

Solve[Eliminate[Dc == k*t0^2 && Dp == k*t1^2, k], Dc]
(* {{Dc -> (Dp t0^2)/t1^2}} *)

• Seems like I need to know ahead of time that $k$ can be eliminated. I was hoping I could just set up the relations and have Mathematica figure out what needed to be eliminated. May 25, 2020 at 23:33
• The trouble is that you already have Dc == k*t0^2, so that's a perfectly good solution. If you want a different solution, you have to somehow specify what it is that you want. With two equations, you get to solve for two variables. So, pick your variables and parameters. If you don't care about a variable, eliminate it. Mathematica can't read your mind here. May 25, 2020 at 23:41
• @Quarkly - Without context, you could just as easily want to eliminate Dp, t1, or t2. May 25, 2020 at 23:50