5
$\begingroup$

I want to find the numbers $a$, $b$, $c$, $d$ of the plane $ax + by +cz +d = 0$ which make the distance from the point $M(1,2,3)$ to the plane equal to 2. I tried

SetSystemOptions[
  "ReduceOptions" -> "ExhaustiveSearchMaxPoints" -> {10000, 100000}];

Clear[n, M];
n = {a, b, c};
M = {1, 2, 3};
TraditionalForm[Simplify[a  x +  b y +  c z + d == 0]] /. 
 Solve[{Abs[n . M + d]/Norm[n] == 2, 
   1 <= a <= 10, -5 <= b <= 10, -5 <= c <= 10, a > b > c}, {a, b, c, 
   d }, Integers]

The set of equations in Mathematica's output contains duplicates, for example: $8 x+6 y-40=0$ and $4 x+3 y-20=0$. How can I eliminate the duplicates?

$\endgroup$
4
$\begingroup$

One possible way is to filter your list afterwards and delete duplicates of answers. Two answers are equal when their coefficients {a,b,c,d} are linear dependent. So when you have two vectors which are linear dependent, their normalized versions v1 and v2 are either equal or they are ones negative: v1==-v2.

You can use DeleteDuplicates with the above rule:

SetSystemOptions[
    "ReduceOptions" -> "ExhaustiveSearchMaxPoints" -> {10000, 100000}];

Clear[n, M];
n = {a, b, c};
M = {1, 2, 3};
sol = Solve[{Abs[n . M + d]/Norm[n] == 2, 
      1 <= a <= 10, -5 <= b <= 10, -5 <= c <= 10, a > b > c}, {a, b, c,d }, Integers]

TraditionalForm[Simplify[a x + b y + c z + d == 0]] /. 
 DeleteDuplicates[sol, 
  With[{v1 = Normalize[{a, b, c, d} /. #1], 
     v2 = Normalize[{a, b, c, d} /. #2]},
    v1 == v2 || v1 == -v2] &]

This gives only 32 of your 38 original solutions and the two equations you mentioned are reduced to the second one.

$\endgroup$
3
$\begingroup$

I would recommend Reduce and EuclideanDistance function.

r = Reduce[ a x + b y + c z + d == 0 && EuclideanDistance[{1, 2, 3}, {x, y, z}] == 2,
            {a, b, c, d}, Integers]
 (a | b | c | d) ∈ Integers && (
    (z == 1 && y == 2 && x == 1 && d == -a - 2 b - c) || 
    (z == 3 && ((y == 0 && x == 1 && d == -a - 3 c) ||
                (y == 2 && ((x == -1 && d == a - 2 b - 3 c) || 
                            (x == 3 && d == -3 a - 2 b - 3 c))) ||
                (y == 4 && x == 1 && d == -a - 4 b - 3 c))) ||
    (z == 5 && y == 2 && x == 1 && d == -a - 2 b - 5 c))

Then e.g. having set an appropriate SetSystemOptions

Normal @ Solve[1 <= a <= 5 && -5 <= b <= 5 && -5 <= c <= 5 && a > b > c && r,
               {a, b, c, d}, Integers]  

then migt be a need for e.g. Factor and DeleteDuplicates.

$\endgroup$
3
  • $\begingroup$ please write for me DeleteDuplicates in your answer. I can't write. Thank you. $\endgroup$ – minthao_2011 Jan 28 '13 at 16:33
  • $\begingroup$ @minthao_2011 My answer was only step toward another possible way to proceed. I'll try to improve it a bit later, perhaps tomorow. Accepting another answer can discourage others because they might think you've got quite a good answer and it is less rewarding for anyone who could provide a better solution. $\endgroup$ – Artes Jan 28 '13 at 18:36
  • $\begingroup$ @minthao_2011 My approach is If[ Factor[#] === #, #, Last@Factor[#[[1]]] == 0] & /@ YourList // DeleteDuplicates // TraditionalForm. It works well. Nontheless I don't understand why you are looking only for integer solutions. Real solutions with help of Reduce look nice e.g. Reduce[{Abs[n.M + d]/Norm[n] == 2, 1 <= a <= 10, -5 <= b <= 10, -5 <= c <= 10, a > b > c}, {a, b, c, d}, Reals]. My solution describes all integer points lying on all planes (of integer coefficients) intersecting the sphere, so it was a bit different than your original search. But it is not clear what you wanted. $\endgroup$ – Artes Feb 4 '13 at 17:22
1
$\begingroup$

You only need add GCD[a,b,c,d]==1 in your code.

SetSystemOptions[
  "ReduceOptions" -> "ExhaustiveSearchMaxPoints" -> {10000, 100000}];
Clear[n, M];
n = {a, b, c};
M = {1, 2, 3};
TraditionalForm[Simplify[a x + b y + c z + d == 0]] /. 
 Solve[{Abs[n.M + d]/Norm[n] == 2, 
   1 <= a <= 10, -5 <= b <= 10, -5 <= c <= 10, a > b > c, 
   GCD[a, b, c, d] == 1}, {a, b, c, d}, Integers]
$\endgroup$

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.