Students first learning about fractions are often taught to "cross-multiply" when dealing with fraction with non-like denominators, however, in Mathematica, with the function SameQ: $$\frac{x}{y}+\frac{a}{b} = \frac{ay+xb}{yb}$$ returns "False," which seems to indicate that cross multiplying does not work universally. Am I doing something wrong here?

(The function SameQ prints "True" if the equations on the left and right side are identical and returns "false" if they are not.)

  • 1
    $\begingroup$ I misunderstood the question and delete my answer. $\endgroup$ – Bernd Jan 16 '14 at 8:02

Mathematica checks that your equation is true for all $x$, $y$, $a$ and $b$ that are in the real numbers (I suppose, you should verify that with your Mathematica documentation).


$$\frac{x}{y}+\frac{a}{b} \ne \frac{ay+xb}{yb}$$

when $y = 0$ or $b=0$.

Added: It might interest you to know precisely from where comes the equation.

We first define $\frac{1}{x}$, as being the inverse element of $x$, denoted $x^{-1}$. This is the element $x^{-1}$ such that $x\cdot x^{-1} = 1$ . This element only exists if $x\ne 0$, because if otherwise, then $x\cdot x^{-1} = 0 \cdot x^{-1} = 0 \ne 1$ which is a contradiction.

If $x, y, a, b \in \mathbb{R}$, $y \ne 0$ and $x \ne 0$, we have

\begin{align} \frac{x}{y}+\frac{a}{b} &= \left ( \frac{x}{y}+\frac{a}{b} \right ) \cdot 1\\ &=\left ( \frac{x}{y}+\frac{a}{b} \right ) \cdot \frac{yb}{yb}\\ &=\left ( \frac{x}{y}\cdot yb +\frac{a}{b}\cdot yb \right ) \cdot \frac{1}{yb}\\ &=\left ( xb +ay \right ) \cdot \frac{1}{yb}\\ &=\frac{xb +ay}{yb} \end{align}

Note that this follows from the assumption that $y \ne 0$ and $x \ne 0$.

  • $\begingroup$ That's interesting because y=0 and b=0 are not allowed on both sides, so both sides should still be equal $\endgroup$ – Bernd Jan 16 '14 at 8:03
  • 1
    $\begingroup$ If $y=0$ but $x\ne 0$, (or otherwise) then the equation would still be false, which is sufficient to say that the equation is not true for all natural numbers. $\endgroup$ – Olivier Jan 16 '14 at 8:08
  • 1
    $\begingroup$ Also, the number $1/x$ only exists (in the reals, at least) if $x$ is non-zero. You cannot deduce anything from numbers that do not exists, so you cannot say that the equation is true when both $x$ and $y$ are zero. $\endgroup$ – Olivier Jan 16 '14 at 8:11
  • $\begingroup$ Yes, but one may think that Mathematica would check for the functions domains. What happens if you ask if $\sqrt{x} = \sqrt{x}$ ? $\endgroup$ – Traklon Jan 16 '14 at 8:17
  • $\begingroup$ Excatly what I meant: actually if you consider both sides as functions, they are the same (and thus equal), because both y and b do not belong to the domain in both cases. $\endgroup$ – Bernd Jan 16 '14 at 8:19

Wolfram Alpha reports the following:

"TrueQ[x/y+a/b=(ay+xb)/(yb)]": False

"Is x/y+a/b=(ay+xb)/(yb)?": True

Which is rather strange. And it doesn't help to make those denominators non-zero, by replacing them with $1+y^2$ and $1+b^2$:

"TrueQ[x/(1+y^2)+a/(1+b^2)=(a(1+y^2)+x(1+b^2))/((1+y^2)(1+b^2))]": False

"Is x/(1+y^2)+a/(1+b^2)=(a(1+y^2)+x(1+b^2))/((1+y^2)(1+b^2))?": True


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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