Consider the following set of points in the 4D space:

points = {{Log[5], Log[2], Log[8/5], Log[23/16]}, {Log[5], Log[2], Log[23/17], 
  Log[17/10]}, {Log[5], Log[16/11], Log[11/5], Log[23/16]}, {Log[5], 
  Log[17/12], Log[23/17], Log[12/5]}, {Log[5], Log[23/18], Log[11/5], 
  Log[18/11]}, {Log[5], Log[23/18], Log[3/2], Log[12/5]}, {Log[5/3], 
  Log[6], Log[8/5], Log[23/16]}, {Log[5/3], Log[6], Log[23/17], 
  Log[17/10]}, {Log[11/7], Log[16/11], Log[7], Log[23/16]}, {Log[3/2],
  Log[17/12], Log[23/17], Log[8]}, {Log[11/7], Log[23/18], Log[7], 
  Log[18/11]}, {Log[3/2], Log[23/18], Log[3/2], Log[8]}, {Log[4/3], 
  Log[6], Log[2], Log[23/16]}, {Log[17/13], Log[6], Log[23/17], 
  Log[13/6]}, {Log[4/3], Log[12/7], Log[7], Log[23/16]}, {Log[17/13], 
  Log[13/8], Log[23/17], Log[8]}, {Log[9/7], Log[23/18], Log[7], 
  Log[2]}, {Log[9/7], Log[23/18], Log[7/4], Log[8]}, {Log[23/19], 
  Log[6], Log[2], Log[19/12]}, {Log[23/19], Log[6], Log[19/13], 
  Log[13/6]}, {Log[23/19], Log[12/7], Log[7], 
  Log[19/12]}, {Log[23/19], Log[13/8], Log[19/13], 
  Log[8]}, {Log[23/19], Log[19/14], Log[7], Log[2]}, {Log[23/19], 
  Log[19/14], Log[7/4], Log[8]}}

All the points lie on a 3D hyperplane since MatrixRank[# - points[[1]] & /@ points] returns 3. How can I show the points in a 3D space (e.g., using Graphics3D) so that the distance of points are kept intact?

  • $\begingroup$ ListPointPlot3D? $\endgroup$ Commented May 24, 2013 at 0:23
  • $\begingroup$ You should project the points into 3d first. $\endgroup$
    – Helium
    Commented May 24, 2013 at 0:25
  • 1
    $\begingroup$ When you say that you want the distance of the points to be left intact, do you mean the distance as measured on the hypersurface, or that in the 4d space. You can look at points on a sphere and their 2d and 3d distance will be very different. $\endgroup$ Commented May 24, 2013 at 0:32
  • $\begingroup$ I mean "the distance as measured on the hypersurface". $\endgroup$
    – Helium
    Commented May 24, 2013 at 0:59

1 Answer 1



I got a MatrixRank of 4 with the original approximate data, but with the updated exact data, the rank is 3.

The basic idea is that Orthogonalize will return an orthonormal basis for the subspace spanned by the vectors, along with some zero vectors interspersed. (Orthonormal means unit length vectors that are pairwise perpendicular.) Deleting the zero vectors leaves the basis in the form of a matrix -- in other words, they form a 3D coordinate system in the hyperplane with the origin at the first point. Multiplying the 4D vectors by the matrix yields the 3D coordinates of the subspace.

With the exact coordinates

The following shows the result:

Graphics3D[{PointSize[Large], Darker@Red,
   With[{vectors = # - First@points & /@ points}, 
    N @ DeleteCases[Orthogonalize[vectors], {0, 0, 0, 0}].Transpose[
       vectors] // Transpose]

Projected points

With the approximate coordinates

Replace the {0, 0, 0, 0} with {0., 0., 0., 0} in DeleteCases. For example,

With[{vectors = # - First@points & /@ N@points}, 
 DeleteCases[Orthogonalize[vectors], {0., 0., 0., 0.}].Transpose[vectors] // Transpose]

The original question had numbers with only six digits of accuracy. In that case one needed

Orthogonalize[vectors, Tolerance -> 10^-5]

and the results were correspondingly accurate (5 decimal places).

  • $\begingroup$ Thanks Michael for your rapid answer. I know pretty much nothing about linear algebra. I get 4 for MatrixRank[points]but 3 for MatrixRank[# - First@points & /@ points]. What does it mean? Doesn't it imply that they lie on a 3D hyperplane? $\endgroup$
    – Helium
    Commented May 24, 2013 at 0:54
  • $\begingroup$ Your result implies that the points lie on a 3D hyperplane, but my result of 4 for MatrixRank[# - First@points & /@ points] implies they do not. Is there an error in the points posted in the question? $\endgroup$
    – Michael E2
    Commented May 24, 2013 at 1:00
  • $\begingroup$ Rounding errors, I guess. I get the same result as yours when I copy the points from the webpage. Could you please explain a bit about the mathematical details of how your code works. $\endgroup$
    – Helium
    Commented May 24, 2013 at 1:10
  • $\begingroup$ I updated the point set. It should be ok now. $\endgroup$
    – Helium
    Commented May 24, 2013 at 1:11
  • $\begingroup$ @Mohsen Yes, the points are ok now. I added some details. I wasn't sure how much additional explanation you needed. $\endgroup$
    – Michael E2
    Commented May 24, 2013 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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