# Solving for variable doesn't appear to work as expected

I'm using Solve to find the time t for t==distance/speed, yet when I verify if t*speed === distance, I'm getting False...

Am I doing something wrong?

Here's my code and the output:

distance = Sqrt[(L + v*t)^2 + x^2];
speed = cmedium;

t11s = Solve[t == distance/speed, t];

(* choose the positive root *)
t11 = FullSimplify[t /. t11s[], assum]

t11*speed === distance
FullSimplify[t11*speed] === FullSimplify[distance]


outputs:

$\frac{\sqrt{c^2 \left(L^2+x^2\right)-v^2 x^2}+L v}{c^2-v^2}$

$\text{False}$

$\text{False}$

Shouldn't I be getting True when checking if expressions are identical... ?

• The expressions are not identical. Nor are the two sides of (x + 1)^2 === x^2 + 2 x + 1. Mathematically equivalent is not the same as identical. – Michael E2 Dec 29 '17 at 4:28

## 1 Answer

Note that === checks whether two expressions are exactly identical. This is not the same thing as testing equality. For example:

FullSimplify[x^2-1 == (x-1)*(x+1)] (* True *)
FullSimplify[x^2-1 === (x-1)*(x+1)] (* False *)


Also note that you have only substituted in the value of t on one side of the equation (with t11). However, t shows up in distance as well, so it needs to be substituted in there or clearly the expressions are not the same: one non-trivially depends on t, while the other does not.

As such, the equation to check is:

t*speed == distance /. t->t11


There it's obvious that the right hand side has nested square roots, which are difficult to bring back together without making unreliable assumptions, so FullSimplify does not directly resolve them.

One way to check this sort of equation is to attempt to search for counterexamples:

FindInstance[{(t speed != distance /. (t -> t11)), 0 < v < c}, {c, v, L, x}, Reals]
(* {} *)


The return of an empty list without errors means that FindInstance does not believe that any value of c, v, L, and x satisfies the inequality. Note that I did add the assumption that 0 < v < c.

• Interesting, thanks. The final suggestion worked for me. – arod Dec 29 '17 at 14:55