Assignment 1
This assignment concerns the topics covered in Dimensions, Vectors and Operations
Dimensions
This question has two parts. Be sure to answer both.
Suppose you are trying to train an AI algorithm for the United States Mail service, that takes in a picture of a box being shipped, and estimates from that photograph the length, width and height of the box. That way, the computer software can quickly take a picture of a stack of boxes, and design an algorithm for how to most efficiently stack them on the truck.
Exercise 1 Part 1: Assume that the input photos are taken in black and white (so, each pixel needs only one color to specify) and of size \(100\) pixels wide and \(75\) pixels tall. As mathematics students, we realize this AI is really just performing a high dimensional function: it is taking as input one of these images, and returning its estimate of length,width and height as its output. What is the dimension of the domain (the inputs), and what is the dimension of the range (the outputs)?
Part 2: What would these dimensions change to if in the future you are asked to update the software to take HD color images (with red green and blue specified for every pixel on a \(1920\times 1080\) computer screen), and the program was to estimate not just the dimensions of the box, but also it’s weight, and the length of time it will take to reach its destination?
Vector Addition
This question has two parts. Make sure to answer both.
You are in charge of controlling a robotic arm which has five joints, and so its configuration in space can be modeled by an \(5\)-tuple of numbers, one specifying the the configuration of each joint. That is, the first number tells the first joint how much to move, the second number tells the second joint how to move, etc.
Exercise 2 Part 1: Starting from the “off” position, which corresponds to the point \((0,0,0,0,0)\), the robot is programmed to do the following sequence of events:
- Move Motor One by 1 unit.
- Move Motor Two by 2 units.
- Leave Motor 3 fixed.
- Move Motor 4 backwards 1 unit.
- Leave Motor 5 fixed
What is the vector that represents this command to the robot?
Part 2: After this, the robot is programmed to move a along the vector in direction \(\langle 1,1,1,1,0\rangle\) of length 4. This leaves the robot arm at some new configuration in space. At this point, you wish to return the robot arm to its starting location \((0,0,0,0,0)\). What direction vector should you command the robot to follow so that it does so?
When you write your answer, show all your work and explain what you are doing in full sentences where necessary to make it so a classmate could easily follow your solution.
Diagonal of a Cube
This question has two parts, and one optional challenge Make sure to do the first two, and I really encourage you to try part III!
Exercise 3 Part 1: What angle does the diagonal of a cube make with one of its faces? To calculate this, we can find the angle between the vector \(d\) which represents the diagonal of the entire cube, and the vector \(f\) which represents the diagonal of one of the faces. Use the geometry of dot products to get \(\cos\theta\) by hand, and then use a calculator to find \(\theta\)? (Make sure you state if your answer is in degrees or radians).
Part 2: Why does the side length of the cube not matter in the calculation above?
Part 3 (Optional, Challenge Problem!): Generalize this by adding another coordinate. What is the angle between the diagonal of a 4-dimensional cube and one of its 3-dimensional faces?
Hint: Call the length of a side of the cube \(s\), and use this to assign coordinates to its vertices using the cartesian coordinate system \((x,y,z)\). Then use these coordinates to determine the vectors corresponding to each of the diagonals
When you write your answer, show all your work and explain what you are doing in full sentences where necessary to make it so a classmate could easily follow your solution.
Solutions
Dimenions
Question 1: The domain is a space of images. If photos are \(100\times 75\) pixels, there are 7,500 pixels in an image. If the image is black and white we need one real number to specify each pixel, so we need \(7,500\) numbers total to specify the image: thus, the domain is \(7,500\)-dimensional, or \(\RR^{7500}\). The range is three dimensional or \(\RR^3\), as we want the computer to output for each image three real numbers: a length (1), width (2) and height (3). Thus, our function is a map \[\mathrm{AI}\colon\RR^{7500}\to\RR^3\]
Question 2: Color images require three numbers per pixel, so the dimension of the space is going to be three times the number of pixels. An HD image has \(1920\times 1080=2,073,600\) pixels, so the domain will be \(3\times 2,073,600 = 6,220,800\) dimensional. The output will now be a point in \(\RR^5\) as we want to predict two additional numbers, for a total of five: length width height weight and delivery time. Thus the new function is \[\mathrm{AI}\colon \RR^{6,220,800}\to\RR^5\]
Vector Addition
Following the procedure, we start at \((0,0,0,0,0)\) to give the command that corresponds to the sequence of steps we want the robot to follow, we make a vector that has in the \(n^{th}\) slot what we want the robot to do: here, that is \[\langle 1,2,0, -1, 0\rangle\] Performing this command, we add this to the original vector, which is \((0,0,0,0,0)\) and we reach the configuration \((1,2,0,-1, 0)\).
Next, we are asked to move the robot in the direction \(v=\langle 1,1,1,1,0\rangle\) by a vector of length 4. To do so, we first need to find the length of \(v\): \[\|v\|=\sqrt{1^2+1^2+1^2+1^2+0^2}=\sqrt{4}=2\] To make this vector length 4, we need to scalar-multiply it by 2, to double its length. This gives us the vector \[2v=\langle 2,2,2,2,0\rangle\] Adding this to our current robot configuration gives the resulting one:
\[(1,2,0,-1,0)+\langle 2,2,2,2,0\rangle = ( 3,4,2,1,0)\]
Finally, we are asked to figure out what command to give the robot to get from here back to its starting configuration \((0,0,0,0,0)\). Remember, if you want to find a vector from a point \(p\) to a point \(q\), you need to subtract the starting point from the ending point: \(u=q-p\). In our case, this means we want to subtract where we are at \((3,4,2,1,0)\) from where we want to end up \((0,0,0,0,0)\) to get
\[(0,0,0,0,0)-(3,4,2,1,0)=\langle -3,-4,-2,-1,0\rangle\]
Which is the final command we want to send the robot.
Diagonal of a Cube
Question 1: Let’s choose our cube to be a unit cube, and lets put one of its vertices at \((0,0,0)\). This means it also has vertices one unit along the \(x,y,\) and \(z\) axes at \((1,0,0), (0,1,0), (0,0,1)\). Filling in the rest of the vertices we have:
We will write both of our diagonals as originating at the upper left corner, which is labeled \((0,0,1)\) in the diagram above. This means we want to compute the face diagonal by subtracting this from its other endpoint, the far vertex \((1,1,1)\): \[f = (1,1,1)-(0,0,1)=\langle 1,1,0\rangle\] Similarly, we compute the main diagonal by subtracting the starting vertex from its end \((1,1,0)\): \[d=(1,1,0)-(0,0,1)=\langle 1,1,-1\rangle\]
We’ve succeeded in turning the entire problem into vectors, so now we can answer it with vector tools! The angle \(\theta\) between \(f\) and \(d\) is defined by the dot product
\[\cos\theta = \frac{f\cdot d}{\|f\| \|d\|}\]
Computing what we need: \[f\cdot d = \langle 1,1,0\rangle\cdot \langle 1,1,-1\rangle= 1+1+0=2\] \[\|f\|=\sqrt{1^2+1^2+0^2}=\sqrt{2}\] \[\|d\|=\sqrt{1^2+1^2+(-1)^2}=\sqrt{3}\]
Thus,
\[\cos\theta = \frac{2}{\sqrt{2}\sqrt{3}}\implies \theta =\arccos\left(\frac{\sqrt{2}}{\sqrt{3}}\right)\approx 0.61547\mathrm{rad}\]
Question 2: The side length of the cube didn’t matter as if we had made the cube side length \(s\), then all of the vectors above would have been multiplied by \(s\). This would have made both \(\|f\|\) and \(\|d\|\) longer by a factor of \(s\), so the denominator would have grown by a factor of \(s^2\). But since both of \(f\) and \(d\) were multiplied by \(s\), the dot product \(f\cdot d\) would also have grown by a factor of \(s^2\), and this would have cancelled the denominator! Thus, no matter how long the cube sides are, \(\frac{f\cdot d}{\|f\|\|d\|}\) would be the same number, so \(\theta\) would be the same.
Question 3: To run this argument in four dimensions, we can no longer picuture what is going on directlym but need to extrapolate. We took the “base point” in our picture to be \((0,0,1)\) in 3D, so perhaps we take \((0,0,0,1)\) as the base point in \(\RR^4\). Making the analogs of \(d\) and \(f\) we find \[f = (1,1,1,1)-(0,0,0,1)=\langle 1,1,1,0\rangle\] \[d = (1,1,1,0)-(0,0,0,1)=\langle 1,1,1,-1\rangle\]
Running the same computation as above we find \[f\cdot d = 3\hspace{0.5cm}\|f\|=\sqrt{3}\hspace{0.5cm}\|d\|=\sqrt{4}=2\] \[\cos\theta =\frac{f\cdot d}{\|d\|\|f\|}=\frac{3}{2\sqrt{3}}=\frac{\sqrt{3}}{2}\] Unlike in \(3D\) this is one of the angles we know from the unit circle, so we can compute \(\theta\) exactly! \[\theta =\frac{\pi}{6}\approx 0.52359\mathrm{rad}\]