Consider the following equation with rational expressions:
$$\frac{5}{x+4}=4+\frac{3}{x-2}$$
We will look at the plot. We will use the Solve command to check our answer.
Plot[{5/(x + 4), 4 + 3/(x - 2)}, {x, -4, 2}] Solve[5/(x + 4) == 4 + 3/(x - 2), x] Now, if the answer provided by the Solve command does not agree with the students' hand calculations, I'd like to use Mathematica to help students find where they made their mistakes.
I've been studying a number of replies on the Mathematica Stack Exchange site (e.g. Alexei Boulbitch's response at Solving equations using algebra.
So consider this start:
eqn = 5/(x + 4) == 4 + 3/(x - 2) Then:
Map[# (x + 4) (x - 2) &, eqn] Then:
Map[Expand[#] &, %] I would like a result like
$$5(x-2)=4(x+4)(x-2)+3(x+4).$$
Any thoughts on how I could produce what I would like, or something close to what I would like?
Instead, I get a very strange result out of my last command.
Not sure why the fractions were not cleared.
I was able to simplify (kinda weird that it factored the left-hand side of the equation):
Map[Simplify[#] &, %] But this doesn't show whether the student hand calculated error was made with the $4(x+4)(x-2)$ piece or the $3(x+4)$ piece.
And, by the way, I was able to finish my problem check with the following additional steps.
Map[Expand[#] &, %] Map[# - %[[1]] &, %] Map[#/2 &, %] Map[Simplify[#] &, %] Map[Factor[#] &, %] Putting it all together looks like this:
eqn = 5/(x + 4) == 4 + 3/(x - 2) Map[# (x + 4) (x - 2) &, eqn] Map[Expand[#] &, %] Map[Expand[#] &, %] Map[# - %[[1]] &, %] Map[#/2 &, %] Map[Simplify[#] &, %] Map[Factor[#] &, %] Update: Some thoughts regarding help from Alexei Boulbitch.
(4 + x) (-5 + 4 x) === 4 (x + 4) (x - 2) + 3 (x + 4) Yields "False."
Then I tried:
(4 + x) (-5 + 4 x) == 4 (x + 4) (x - 2) + 3 (x + 4) // Simplify Which yielded True. I looked up the === sign in the Documentation and it said "lhs === rhs yields True if the expression lhs is identical to rhs, and yields False otherwise."
Consider also:
Expand[(4 + x) (-5 + 4 x)] Which yields:
(* -20 + 11 x + 4 x^2 *) Consider:
Expand[4 (x + 4) (x - 2) + 3 (x + 4)] Which also yields:
(* -20 + 11 x + 4 x^2 *) So, what is going on with that === thing?




WolframAlpha["5/(x+4)\[Equal]4+3/(x-2)"]and click on "Step-by-step solution" at upper right of the "Solutions" pane. $\endgroup$