in this series of videos we're going to ask an obvious question that arises when we track the trajectories of two objects in the same space and in particular we're going to look at whether those objects would collide if they follow those trajectories or possibly a near miss or a pharmacist where they go through the same point in space but at different times and there's obvious tie-ins here to important engineering safety things such as autonomous cars as well as tracking spaceships space debris and ensuring that there wouldn't be collisions between known objects when we're in outer space as well we're going to look at the mathematics of this and see how we can test strategies using our ideas about trajectories and them being formulated as vector-valued curves so we're gonna start with this example where we have t squared and t and a separate trajectory called u with uh three minus two t and four t minus three and we already have hopefully a bit of intuition this looks like it's going to have some kind of quadratic shape based on the relationship between the x and y coordinates and the fact that the x and y functions here are both linear and t would lend us to believe that this is going to be a straight line somehow in xy space but let's just do a quick review of this with our subbing in values table of values start with t and this is going to be for r of t and we'll do our usual span here there's no domain issues so we'll start negative go positive using nice integers negative two squared for x is four negative one squared is one zero squared zero and two squared four and the y values are even easier they are just the same numbers as the time values same as this column here so we can see fairly quickly here our quick sketch of the axes if we draw the u-curve then it's going to subtract 4 and negative 2 1 and negative 1 and like so that will be the curve traced out and if we check the direction as time is increasing we can add some arrows on that and that would define the rft trajectory so a particle moves along here times zero reaches this vertex and keeps going on the other hand the second trajectory is going to be u and it has t and x and y coordinates as well for consistency let's see what we get here and 3 minus 2 t 3 minus minus 2 minus 4 is going to give us 7 for x and let's just keep going through the x's first 3 minus 2 plus 2 rather it's going to be 5 3 minus 0 is 3 3 minus 2 is 1 2 minus 3 minus 4 is going to be negative 1. so we see our x coordinates start at 7 and then work their way back towards negative 1 here in the y direction what do we have we have 4 times this that's negative 2 times 4 is negative 8 minus another 3 is negative 11 and each time we go up 1 and 2 we're going to go up 1 and up 4 in y so negative 7 0 to double check is minus 3 1 everything's positive now it's a little easier as plus one and last but not least for this table is eight minus three is five and yes indeed we see this is going up by four each time that's nice just clean up that one a little bit and that gives us a little harder to see here because we go off the axis pretty quickly but we have some points that we can refer to such as let's do this in black one two three one two three three negative three and then one for x and one for oh there's a possibility right there um and negative one and five one two three four five here we go so we should be able to draw a straight line through those and so ish like that and that trajectory the x's are decreasing as time goes up if t goes up we subtract more and so the x decreases and that gives us a relationship or the direction of travel being up and to the left here and without any actual calculation so far what we see is that there will be at least two intersections we don't know the timings of this but we know that this blue line is going to pass through this coordinate and this coordinate as to will the black line defining the u trajectory it's now our job to figure out how can we use some mathematics and the algebra to identify those two points and determine whether they are collision or just a missed intersection where one particle goes first and then the second particle follows that same point a little later well what do we mean by collision if we imagine our axes here and we take two patterns and let's just keep them essentially random for this time so we don't confuse ourselves the real graph that we're looking at in this example we would have a collision if we are at the same x y point but that's not enough if we're at the same x y point but at the same time so in other words we can be coming from below here but we have to reach that point say at t equals a and then we have to be going on the blue line and reaching the same point at t equals a same point in space same time that's what we mean by two particles colliding that's how you'd run into someone on the stairs if you're both in the same location at the same time contrast that with the idea of trajectories that just cross or that intersect we still need the same location so we're going to have the same xy point on both trajectories but different times and we're going to explore how to represent that this tends to be the slightly more confusing one this one most of us can kind of get our heads around pretty quickly so imagine here if we're going along this curve and we reach this coordinate on the black trajectory at t equals a but as we come along the blue line we reach that same point but at t equals b or what we're going to do is call this maybe t1 and t2 that makes nice and clear uh we're going to actually change that as another thing that makes sort of sense um we might use t for one of these and a variable very close to t that's still going to play the role of the time you'll see frequently s being used for these kinds of problems and the idea being there's some number for time on this trajectory and some number t for time on this trajectory that both lead to the same x y coordinates so a quick setup of the equations what we're going to have here is the x on the r curve is going to equal the x on the u curve at the same time so we're going to be able to use t for both these equations if there's a t i can sub into the x coordinate for both of these and get the same x that's halfway to a collision the other part of course is that our y coordinates would also have to match and it's just really easy to sort of mix and match these accidentally but we want the x coordinates to be the same on the different paths so it's going to be these two things here have to equal each other and then the y coordinates have to be equal to each other as well to have a collision and at the same t so all these have to work together the difference here for intersection but not collision is that the x on the r value or the r trajectory has to equal x on the u trajectory but possibly different times at let's phrase it this way at the x time sorry not the x time each trajectory is separate that's where it's easy to get confused the r time equals t and the u time equals s so that's where we're going along the black line here is our r curve when we get to this point here we're going to call that time t meanwhile on the u path we're going to cross it along and we're going to say time is being called s on that curve and we're going to reach it at some special time s so the other equivalent thing is we also need the y coordinates to be equal so the y and the r has to equal the y on our u curve and again possibly at two different times for r and u we'll see how this plays out in the math that'll hopefully make things more concrete we're going to start with the collisions because again i mentioned that's usually what people see is more straightforward let's see how that plays out here so the x coordinates have to be equal at the same time so the x coordinates for the two trajectories have to be the same that means t squared has to equal three minus two t and we need for the y coordinates to be equal we have to have t equals four t minus three and so how do we play these two things together well it's just two equations and one unknown so in fact we can solve this a number of different ways if we look at equation two simply because it's all linear that's the tempting one to start with from it we can learn that if we bring the t over here we'll have three t's bring the negative three over here we'll have three and we're gonna get t equals one is the only solution so the y-coordinates were going to equal each other only at t equals 1. now the second follow-up is whether that time also gives us the same x coordinate maybe we are at the same time in the same y but different x's let's see that so we're going to check if the x's are equal at t equals one so we're not subbing in we're just checking to see whether that's true the left-hand side of equation one is going to be t squared which is equal to one squared which is one the right hand side of equation two is three minus two t and when we sub in our one that's going to be three minus two times one and that is one excellent so we do in fact see the same x coordinate at t equals one all that together does point to a collision so at t equals one the particles collide at we already found it the x coordinates are both one and the y coordinates actually didn't check that in but the y we can get by quickly summing in back into equation two and we're going to have one one as our intersection point going back to our diagram for a moment our sketch that would be this intersection point that we saw earlier only now we know it's more than just an intersection it's actually a collision at time one both particles are in that location the fact that this other point didn't show up in our analysis though says there's going to be a second intersection and it won't it will not be a collision uh it must be two different times that we're passing through this otherwise this equation solving would have turned up that secondary point so how do we find the location of that intersection as a follow-up well remember we're going to look at x and we're going to have our r of t here and it's going to be equal to u i can't use t because that would mean we're tracking both trajectories at the same time same passage of time we're interested in the same location different times and if it helps i like the tns version let's just move this down a bit give us some space so you can write it different ways if you like another way to think about this would be r at some time one is equal to u the xy coordinates of u at some time t2 the reason i don't use this is simply there's too many subscripts and by the time you have subscripts and squares it's a lot of bookkeeping t and s look different they're easier to write it's entirely a style choice i would argue that this probably carries the meaning more clearly this is just easier to work with when you have multiple equations you're trying to solve so let's set up those equations so we're going to align these vertically for the x coordinates we have to have t squared equals this time it's u at some not t but some time value s so our second time and that will be 3 minus 2 s and our y coordinates are the same equalities here but let's do that the same color we did before just for consistency it's t on the left hand side but anything to do with u we're going to use the time value s for s minus 3. all right that gives us our two equations again only now we have a little more freedom because we have two variables that we can track down looking at this it's probably easiest to take s and put it into this equation so we don't have some nasty things to square and if we do that we just solve for s here we're going to get t plus 3 equals 4s or s equals t plus 3 all over 4. let's call that equation 3. equation three we can now sub into equation one and see if we can track this down so right now it looks like we can get the y coordinates to align as long as the t's and s's have a certain relationship but now we want the y coordinates to be or sorry the x coordinates to be equal as well how do we achieve that with this constraint when we sub 3 into 1 and we get t squared equals 3 minus 2 s's but each s has to equal 2 plus 3 over 4. there we go and we're just going to tidy that up a little bit we're going to get t squared equals 3 minus 2t over 4 is t over 2 and 6 over 4 is 3 halves no one likes solving quadratics like this so we're going to put that into equal zero form so we have t squared plus t over 2 and by the time this is done it's positive three over two and bring it to the other side it's negative three over two so so simply manipulating this equation and looking at these two things here which are equal to positive three halves when we combine them we bring them over to the other side they become negative three-halves and that is not super obvious to factor but that's going to be t something and t something equals zero and what something's product of minus three has some positive one half that sounds like three halves and one and let's get the signs right here there we go we'll have minus one plus three halves that'll be plus t over two for the middle term and negative three halves there factor however you like use the quadratic equation if that floats your boat it doesn't really matter the key thing is you're going to arrive at two possibilities t equals one and t equals negative three halves so what's that telling us it's telling us that the intersection times on r where we're going to go through the same point as the u curve and so we see two times and that makes sense because we go back to our diagram we are expecting to find two different times if we're following the parabola on r here we would encounter this point here at negative three halves time negative three half seconds we keep going times zero and then time one gets us here oh we already knew about that point that's our collision but now we can focus in on this intersection point more clearly it'll it'll be at this time negative three halves we're gonna go through the full process here though and just remind ourselves of how we would get all the other information that we need in particular if we have s equals let's go back here we had s equals t plus 3 over 4 so at t equals one our s value which is the what time are we at in the u trajectory clock we're going to be at one plus three over four much better known as one that was our collision from earlier earlier and that was at the 0.11 and the new point the t equals negative three halves our s again using our equation three here our s is going to be negative three halves in brackets plus a big three all over four and that's going to take some algebra grab your calculator with a fraction tool if you like we're working out long hands negative 3 8 plus 3 quarters and oh that's half of that or subtracting it that'll give us positive 3 8 when we're done and so we have the time of that second intersection now let's just confirm the same x y for both trajectories how do i know for sure that we have made a mistake well at t equals negative three halves r of negative three halves is using the formula up here is t squared so negative positive nine quarters rather because we're squaring and t itself is negative three halves and meanwhile the value we found for this the u curve which is s is three eighths u at three eighths is three minus two times three eighths and let's do the other one while we're here four times three eighths minus three and again if we do our quick calculations that's minus three quarters no that's exactly nine quarters phew and also if we do the algebra here this will be three halves minus three that's also negative three halves and so we have an intersection at nine quarters negative three halves and so we can actually add that to our diagram here way back at the beginning this location is exactly negative nine quarters rather positive and negative three halves in the y direction and we also know exactly when we're going through those two points so focus initially if this is new especially on the rationale for why we set the x y equal but use different time values on either side of this equation one time value for one trajectory and a separate distinct time value for the other trajectory and just because it helps to confirm these things there's some code here that you can look at we're simply going to run it but we'll see an animation of both those trajectories and we'll see the intersections at keep an eye on the times 3 8 was the straight line trajectory and time negative 3 halves was when the parabola went through that second intersection point and then at time 1 they both also collided so we're going to animate that here and see what that looks like so we have the arcs here and as the timer moves forward a little haltingly we see that the parabola is going to the trajectory on the parabola is going to reach this point earlier at negative well let's wait for it oh look negative 3 halves or negative 1.5 then we're gonna have to wait until time goes past zero zero is when this arc actually reaches the vertex and we should see the black dot hit this intersection point three eighths it's around point four point three seven perfect and then as we get closer and closer here we hit we see the full collision at time equals one so a quick diagram tells us that there are two intersections period doing the careful analysis of the algebra lets us determine which of those intersections rather are actually collisions or just passing through the same point at different times and specifically where and when those