# Problem about Solve

See this example :

Solve[x^2 == (a - b)^2, x]   (* {{x -> a - b}, {x -> -a + b}} *)

Solve[x^2 == 4 (a - b)^2, x]
(*{{x -> -2 Sqrt[a^2 - 2 a b + b^2]}, {x -> 2 Sqrt[a^2 - 2 a b + b^2]}}*)

Reduce[x^2 == 4 (a - b)^2, x]
(*x == 2 a - 2 b || x == -2 a + 2 b*)


More complicated,

Solve[{(x - x1)^2 + (y - y1)^2 == (x1 - x2)^2 + (y1 - y2)^2,
(x - x2)^2 + (y - y2)^2 == (x1 - x2)^2 + (y1 - y2)^2}, {x,  y}] // FullSimplify


gives $\left\{\left\{x\to \frac{1}{2} \left(\text{x1}+\text{x2}-\sqrt{3} \sqrt{(\text{y1}-\text{y2})^2}\right),y\to \frac{\sqrt{3} (\text{x1}-\text{x2}) \sqrt{(\text{y1}-\text{y2})^2}+\text{y1}^2-\text{y2}^2}{2 (\text{y1}-\text{y2})}\right\},\left\{x\to \frac{1}{2} \left(\text{x1}+\text{x2}+\sqrt{3} \sqrt{(\text{y1}-\text{y2})^2}\right),y\to \frac{\sqrt{3} (\text{x2}-\text{x1}) \sqrt{(\text{y1}-\text{y2})^2}+\text{y1}^2-\text{y2}^2}{2 (\text{y1}-\text{y2})}\right\}\right\}$

but I excepted result is

$\left\{\left\{x\to \frac{\text{x1}}{2}+\frac{\text{x2}}{2}-\frac{\sqrt{3} \text{y1}}{2}+\frac{\sqrt{3} \text{y2}}{2},y\to \frac{\sqrt{3} \text{x1}}{2}-\frac{\sqrt{3} \text{x2}}{2}+\frac{\text{y1}}{2}+\frac{\text{y2}}{2}\right\},\left\{x\to \frac{\text{x1}}{2}+\frac{\text{x2}}{2}+\frac{\sqrt{3} \text{y1}}{2}-\frac{\sqrt{3} \text{y2}}{2},y\to -\frac{\sqrt{3} \text{x1}}{2}+\frac{\sqrt{3} \text{x2}}{2}+\frac{\text{y1}}{2}+\frac{\text{y2}}{2}\right\}\right\}$

both Reduce and FullSimplify can't gives a better result, How can I get the result as I want?

-
You can try FullSimplify[ Solve[{(x - x1)^2 + (y - y1)^2 == (x1 - x2)^2 + (y1 - y2)^2, (x - x2)^2 + (y - y2)^2 == (x1 - x2)^2 + (y1 - y2)^2}, {x, y}], Assumptions -> {y1 - y2 > 0}] // Expand. –  b.gatessucks Jul 23 '13 at 5:58
add comment

## 1 Answer

Solve[{(x - x1)^2 + (y - y1)^2 == (x1 - x2)^2 + (y1 - y2)^2, (x -
x2)^2 + (y - y2)^2 == (x1 - x2)^2 + (y1 - y2)^2}, {x, y}] //
Factor // PowerExpand // Simplify // Expand

(*{{x -> x1/2 + x2/2 - (Sqrt[3] y1)/2 + (Sqrt[3] y2)/2,
y -> (Sqrt[3] x1)/2 - (Sqrt[3] x2)/2 + y1/2 + y2/2}, {x ->
x1/2 + x2/2 + (Sqrt[3] y1)/2 - (Sqrt[3] y2)/2,
y -> -((Sqrt[3] x1)/2) + (Sqrt[3] x2)/2 + y1/2 + y2/2}}*)

-
add comment