# How to visualize a map $f:R^3 \to R^2$

I want to visualize $\{x1,x2,x3\}\to\{x1 + 2 x2, 3 x3-x1\}$,but we cannot use ParametricPlot like following,because this map have three parameters.

ParametricPlot[{x1+2x2,3x3-x1},{x1,-10,10},{x2,-10,10},{x3,-10,10}]


We will get some error informations.The current method is plot some discrete points to know it:

Graphics[Point[
Level[Table[{x1 + 2 x2, 3 x3 - x1}, {x1, -10, 10, .5}, {x2, -10,
10, .5}, {x3, -10, 10, .5}], {3}]]]


Are there better solution can visualize it not just by some discrete points?

• You could map a variable square in R^3 to its image, and show both side by side, while manipulating the square. It's a linear map, so nothing very complicated is going on. (Here's the same idea applied to the reverse direction, R^2 -> R3: demonstrations.wolfram.com/…) – Michael E2 Jul 3 '16 at 21:42
• @MichaelE2 Sorry,it seem cann't fully understand you. – yode Jul 3 '16 at 21:46
• Sorry, I don't know how to respond. "variable square" = "a square you can move about R^3". Otherwise, I'm stumped. – Michael E2 Jul 3 '16 at 21:51
• @Kuba Your comments make me deeply impressive always. – yode Jul 4 '16 at 11:05

Let's show how a unit cube is projected, that is quite explanatory:

Table[
ParametricPlot[{x1 + 2 x2, 3 x3 - x1}, {#, 0, 1}, {#2, 0, 1}],
{#3, {0, 1}}
] & @@@ {{x1, x2, x3}, {x1, x3, x2}, {x2, x3, x1}} // Flatten // Show[
#,
Graphics @  Table[
Inset[{##}, {#1 + 2 #2, 3 #3 - #1}] & @@ p,
{p, Tuples[{0, 1}, {3}]}
],
PlotRange -> All, Axes -> False, PlotRangePadding -> Scaled[.1]
] &


We can try to use ViewMatrix to show it too:

p = N @ {{1, 2, 0, 0}, {-1, 0, 3, 0}, {0, 0, 1, 0}, {0, 0, 0, 30}};

{x1, x2, x3} = IdentityMatrix[3];

t = N @ TransformationMatrix @ TranslationTransform[3 {1, 1, 2}];

Graphics3D[{
Thick,
FaceForm@Opacity@.3, EdgeForm@Thick, Cuboid[{1, 1, 1}], Cuboid[],
Sphere[{-1, -1, -1}]
},
Boxed -> True, ViewMatrix -> {t, p},
PlotRange -> 3
]


• I suddently get that quite explanatory right now.Awsome! – yode Jul 6 '16 at 10:47
• @yode No problem :) p.s. ViewMatrix may be of use too (won't be preserved when rotating but it is something). – Kuba Jul 6 '16 at 11:53
• @yode Kudos to Kuba :) for the clarifying answer, but I thought the unit cube projection plot insight in this answer is also obtained from the first plot of my answer by following the numbers of the points (e.g. the ones at the corners). – Anton Antonov Jul 6 '16 at 12:09
• @AntonAntonov I'm sorry for change the acceptation, :)I just think this coordinate map reveal the nature more distinct.Of course,we can know the rule as your following numbers of the points – yode Jul 6 '16 at 12:20
• @yode Please do not be sorry for changing the acceptance (in this case and in general)! Better and more relevant answers should be able appear later. I mostly wrote my previous comment, I think, because it is/was not clear from your question are you looking for a nice visualization or for an enlightening one, is it for personal use or for a presentation. Although, , of course, being that specific might restrict the answers too much... – Anton Antonov Jul 6 '16 at 12:31

I am not sure is this an answer you are looking for, but the following graph does visualize the mapping.

cubePoints3D =
Flatten[Table[{x1 , x2,  x3 }, {x1, -10, 10, 5}, {x2, -10,
10, 5}, {x3, -10, 10, 5}], 2];
cubePoints2D =
Function[{x1, x2, x3}, {x1 + 2 x2, 3 x3 - x1}] @@@ cubePoints3D;
offset = {0, 0, 50};
cubePoints2Dto3D = Map[Append[#, 0] + offset &, cubePoints2D];

Graphics3D[{GrayLevel[0.4],
Line[cubePoints2Dto3D],
PointSize[0.02],
MapIndexed[{Blend[{Blue, Red, Yellow}, #2[[1]]/
Length[cubePoints2Dto3D]], Point[#1]} &, cubePoints3D],
Gray, FaceForm[None], Red, PointSize[0.02],
MapIndexed[{Blend[{Blue, Red, Yellow}, #2[[1]]/
Length[cubePoints2Dto3D]], Point[#1]} &, cubePoints2Dto3D],
Black, MapIndexed[Text[#2[[1]], #1, 2 {1, 1}] &, cubePoints2Dto3D],
GrayLevel[0.9],
Black, MapIndexed[
Text[Style[#2[[1]], Background -> White], #1, 0 {1, 1}] &,
cubePoints3D]}, Boxed -> False, ImageSize -> 1000]


And here is a variation with more points, no labels, and a sample of arrows:

• Well, at least it's pretty. Reminds me of a description of an experimental 64-CPU chip in 1980s that supposedly had a "hypercube" configuration of connectivity (i.e. a 4-cube array mapped into a 3D chip). Of course, this image is one dimension less. – Michael E2 Jul 4 '16 at 0:20
• Good effect. :) – yode Jul 4 '16 at 0:39
• @yode Thanks, hopefully it is also useful ! – Anton Antonov Jul 4 '16 at 0:41

How about a vector field approach?

VectorPlot3D[{x1 + 2 x2, 3 x3 - x1, 0}, {x1, -10, 10}, {x2, -10,
10}, {x3, -10, 10}]


Animate[
VectorPlot[{x1 + 2 x2, 3 x3 - x1}, {x1, -10, 10}, {x2, -10, 10},
PlotLabel -> StringTemplate["x3 = "][x3]],
{x3, -10, 10}
]


Animate[
StreamPlot[{x1 + 2 x2, 3 x3 - x1}, {x1, -10, 10}, {x2, -10, 10},
PlotLabel -> StringTemplate["x3 = "][x3]],
{x3, -10, 10}
]