3D in Geogebra – the vector equation of a line Paul Robinson, IT Tallaght Websites Geogebra Homepage: http://www.geogebra.org/cms/ Use the Appletstart Version of Geogebra or download a stand alone version. Geogebra Forum: http://www.geogebra.org/forum/ Community of Geogebra users, bug reports and feature requests Geogebra Facebook Group: http://www.facebook.com/home.php#!/geogebra Pretty active, conference news, lots of helpful stuff Geogebra Wiki: http://www.geogebra.org/en/wiki/index.php/English Collection of re-usable teaching resources University of Limerick: http://www.ul.ie/cemtl/resources.htm Excellent GeoGebra step by step demos – Math 247: http://math247.pbworks.com/Learn-and-Use-GeoGebra Fantastic Step-by-Step Help on How to Use GeoGebra by Dr Linda FahlbergStojanovska. Includes accessing Geogebra properties and methods using Javascript very cool. LaTeX online equation editor: http://www.numberempire.com/texequationeditor/equationeditor.php Indispensible if you want to put mathematics into Moodle and don’t know any LaTex! Introduction Geogebra can do a pretty good job of representing 3D objects, allowing rotations and dilations to view things from different angles and to zoom in. These notes are based on a construction by Michele Passante (http://www.mateblog.it/?p=372). px First a bit of theory: Let P py be a point in 3D space. The 3D rotation matrices about p z the x, y and z axis are 0 0 1 Rx 0 cos(a) sin(a) 0 sin(a) cos(a) cos(b) 0 sin(b) Ry 0 1 0 sin(b) 0 cos(b) cos(c) sin(c) 0 Rz sin(c) cos(c) 0 0 0 1 where a, b and c are angles between 0o and 360o. The rotation RX will rotate P in the horizontal plane anticlockwise about the vertical z axis through an angle of a, and similarly for Ry and Rz. If we rotate P and the x, y, z coordinate frame using R we can interpret the result as a rotated view of the original point P. This is what we will do in the construction which follows. We will write a general rotation as R Rz Ry Rx , which will allow us to rotate about the 3 axes. Note that the 3 rotations do not commute with each other, meaning that if we write them in a different order the result will generally be slightly different! This will not matter in terms of using rotations to view 3D objects. qx After rotation the point P will have 3D coordinate RP qy q z where the q coordinates now depend on the angles a, b and c. To see what this looks like in 2D (on the screen!) we simply want two of the coordinates of RP. If we imagine the x axis pointing out of the screen towards us then the screen coordinates are y, z. This qy means we need to plot the point Q . qz This construction is OK, but it is not very flexible. As well as Q we will want to extract some other information from the 3D point RP, and it is not easy to do in GeoGebra with RP in this form. Instead we will start with px 1 0 0 P py p x 0 py 1 p z 0 p x E x p y E y p z E z 0 0 1 p z Now RP px RE x py RE y pz RE z . We can now think of px as the component of the rotated P in the direction of the rotated axis RE x . If we let Wx be the 2D vector with components the y and z coordinates of REx , and similarly for Wy and Wz then we have Q pxWx pyWy pzWz The vectors pxWx , pyWy and pzWz are the components of the rotated P along the rotated axis as viewed on the screen. We will construct the rotation of a 3D point P with its axis frame. The point P does not change its position, just our rotated view of it changes. Creating a 3D axis frame 1. Put on sliders for angles a, b, c and another named d which will be used to lengthen and shorten our axes: Click on the slider tool then on the drawing pad. Call it a and select the angle option. Go with the default of 0o to 360o. Repeat for sliders b and c. Create another slider called d with a Number value from 0.5 to 5 in steps of 0.1. Right click the sliders (or their values in the left hand window) if you want to change their properties. click on the object selection tool if you want to move the sliders around. 2. Put in unit vectors along the x, y and z axes. In the input line at the bottom of the screen type E_x = {{1}, {0}, {0}} press return 1 This represents the column vector E x 0 . A row of numbers would be written as 0 {1, 0, 0}. We need a column as we want to multiply by a matrix. Repeat the input for E_y = {{0}, {1}, {0}} and E_z = {{0}, {0}, {1}} 3. Put in the rotation matrices Rx, Ry and Rz and the dilation matrix D In the input line type R_x = {{1, 0, 0}, {0, cos(a), -sin(a)}, {0, sin(a), cos(a)}} R_y = {{cos(b), 0, -sin(b)}, {0, 1, 0}, {sin(b), 0, cos(b)}} R_z = {{cos(c), -sin(c), 0}, {sin(c), cos(c), 0}, {0, 0, 1}} press return press return press return For the general rotation type R = R_z*R_y*R_x 4. Create our axes In the input line type V_x = R*E_x press return press return This will rotate (and dilate) the unit vector E_x which is pointing along the x-axis. Repeat for V_y = R*E_y and V_z = R*E_z Now we need to see what that looks like on the screen. The vectors V_x, V_y and V_z are column vectors. As mentioned in the introduction we want the 2nd and 3rd components of our 3D vectors to create a point on the screen. This is probably a good point to turn off labeling. Go to Options, labeling and click on No New Objects. In the input line type W_x = (Element[Element[V_x,2],1], Element[Element[V_x,3],1]) and press return. Element[V_x,2] is the second number in V_x, which is itself a list { } consisting of 1 number. We want the “first” number in that list. The round brackets in W_x mean that we now have a point in 2D which you should see on the screen. Repeat for W_y = (Element[Element[V_y,2],1], Element[Element[V_y,3],1]) W_z = (Element[Element[V_z,2],1], Element[Element[V_z,3],1]) In the input line type u = vector[d*W_x] press return Repeat for v = vector[d*W_y] and w = vector[d*W_z]. Hide the points W_x, W_y and W_z by clicking on the circles next to their definition in the left hand window. Click on the object Selection Tool then move sliders a and b to 30o, followed by moving c. See that d makes things bigger and smaller. 5. Make the axes look a bit nicer. Go to View and click on Axes to remove the default GeoGebra axes. Right click on the u vector (do it in the definition in the left hand window) and go to Properties at the bottom of the list. Use ctrl or shift to select u, v and w in the vector list simultaneously. Set the Colour to dark blue and the Style line thickness to 5. In the input line type –u and press return. Do the same for –v and –w. Select these 3 new vectors as before, leave the colour on black and the line thickness as thin but change the line style to fine dots. We also need to label our axes. Click on the small arrow at the bottom of the Slider Tool and select the Insert Text option. Click on the screen anywhere and type X for the text. Now right click the X text, go to Properties and Position. In the Starting Point box type 2*W_x. You may use the mouse to move the X text slightly but as you move the slider controls a, b, c and d it should follow the arrow head of the x-axis. Repeat this text insert for Y (Starting position 2*W_y) and Z (Starting position 2*W_z). As a final flourish type Polygon[d*(W_x+W_y), d*(-W_x+W_y), d*(-W_x-W_y), d*(W_x-W_y)] And press return. Right click each side of this polygon and click off Show Object. Use the Panning Tool (click it then drag on the screen) if you want to centre your construction a little. Click the little arrow on the panning tool to bring up the Zoom In and Zoom Out Tools (click then click the screen) if you want your picture bigger or smaller. We can now put other objects on our axes frame like points, lines and planes and see what they look like in 3D. We can also make geometric objects e.g. a cube made up of corners (points) and faces (polygons). The vector equation of a line in 3D In the input line type the column vector P_1 = {{1}, {1}, {1}} As discussed in the introduction this will have the screen coordinate Q _ 1 p1xWx p1yWy p1zWz . In the input line type p_{1x} = Element[Element[P_1, 1], 1] p_{1y} = Element[Element[P_1, 2], 1] p_{1z} = Element[Element[P_1, 3], 1] Q_1 = p_{1x}*W_x + p_{1y}*W_y + p_{1z}*W_z And press return after each line. Repeat this process to produce the point Q_2 from the point P_2 = {{1}, {-2}, {-1}} (after defining p_{2x}, p_{2y} and p_{2z}). In the input line type Line[Q_1, Q_2] You should see a line through the two points. Rotate the figure to see the effect. If P1 and P2 are two column vectors in 3D then the vector equation of the line through those points is given by r P1 t(P2 P1 ) Here t is any positive or negative number and r describes where you are on the line in terms of t e.g. If t = 0, r is at P1 and if t = 1 then r is at P2. Put a slider on the screen named t with values from -5 to 5. In the input line type vector[Q_1+t*(Q_2 – Q_1)] Right click the vector and colour it red with a thickness of 5. Move the slider to see that r runs along the line. What is the effect on the vector of swapping over Q_1 and Q_2?