5
$\begingroup$

There are two equations:

eq1 = x1^2/a^2 + y1^2/b^2 == 1;
eq2 = x2^2/a^2 + y2^2/b^2 == 1;

How to get this result by subtracting two equations?

the result

((x1 - x2) (x1 + x2))/a^2 + ((y1 - y2) (y1 + y2))/b^2 == 0
$\endgroup$

5 Answers 5

8
$\begingroup$

subtracting two equations?

You can use SubtractSides which is designed for this sort of operation.

ClearAll["Global`*"]
eq1 = x1^2/a^2 + y1^2/b^2 == 1
eq2 = x2^2/a^2 + y2^2/b^2 == 1
SubtractSides[eq1, eq2]

Mathematica graphics

To simplify it more

SubtractSides[eq1, eq2] // Simplify

Mathematica graphics

Without using this command, there are other ways to do this. See Subtracting equations from each other? for more options.

$\endgroup$
4
$\begingroup$
(eq1 - eq2 /. Equal -> List // Equal @@ # & // 
   Collect[#, {a, b}] &) /. (a_^2 - b_^2) :> (a + b) (a - b)

$$\frac{(\text{x1}-\text{x2}) (\text{x1}+\text{x2})}{a^2}+\frac{(\text{y1}-\text{y2}) (\text{y1}+\text{y2})}{b^2}$$

$\endgroup$
3
  • $\begingroup$ Could you have a look at my SDE question: mathematica.stackexchange.com/questions/276606/…. Thank you! $\endgroup$
    – Math
    Commented Jan 30, 2023 at 12:52
  • $\begingroup$ @Math, I don't have enough expertise in that area. The most qualified participants have already looked at it. If you have another question, it is best to start a fresh post. Thanks. $\endgroup$
    – Syed
    Commented Jan 30, 2023 at 13:30
  • $\begingroup$ No problem, Thank you anyway :) $\endgroup$
    – Math
    Commented Jan 30, 2023 at 13:46
3
$\begingroup$

Try also this:

eq1 = x1^2/a^2 + y1^2/b^2 == 1;
eq2 = x2^2/a^2 + y2^2/b^2 == 1;



  expr=Equal @@ MapThread[Subtract, {List @@ eq1, List @@ eq2}] // Simplify

(*  (x1^2 - x2^2)/a^2 + (y1^2 - y2^2)/b^2 == 0  *)

If you need them factorized:

MapAt[Factor, expr, {{1, 1}, {1, 2}}]

(*  ((x1 - x2) (x1 + x2))/a^2 + ((y1 - y2) (y1 + y2))/b^2 == 0  *)

Have fun!

$\endgroup$
3
$\begingroup$

Another way to do this is as follows:

FullSimplify[Thread[#[[1]] == #[[2]]] &@(#[[1]] - #[[2]] & /@ 
Transpose[Level[#, {1}] & /@ {eq1, eq2}])]

enter image description here

$\endgroup$
0
$\begingroup$
eq1 = x1^2/a^2 + y1^2/b^2 == 1;
eq2 = x2^2/a^2 + y2^2/b^2 == 1;

Original way

eq1 - eq2 // Thread[#, Equals] & // Simplify
(* (x1^2-x2^2)/a^2+(y1^2-y2^2)/b^2==0 *)

If you use EqualThread found at https://library.wolfram.com/infocenter/MathSource/4491, then it will be seamless.

eq1 - eq2//Simplify

to get the same answer.

$\endgroup$

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