 Now, suppose trajectory is entering here and here the coordinates of this particle or trajectory is designated by the column vector. This is x0, x0 shows the displacement with respect to the design axis at the entrance of the magnet and x prime 0 is the angle made by trajectories at the entrance of the magnet with respect to the descent trajectory and suppose trajectory exits from here from this magnet. So, here also you can define a column vector showing the state of motion or coordinates x and x prime of this trajectory at the exit of the magnet with respect to descent trajectory and this is the matrix of this magnetic element which connects the initial coordinates to the final coordinates. And this matrix of any element in accelerator jargon is known as transfer matrix of the magnet. Now, we will put the value of k for individual magnets and we will get the individual elements matrix. So, for drift space we will put k is equal to 0 in the matrix. So, in the k is equal to 0, the first element was cos root kn. So, k is equal to 0 means cos 0 it will become 1, similarly you can obtain rest of the elements. So, this element will be l only and this element will be 0 and this element 1. So, this is the transfer matrix of the drift space in horizontal plane. Similarly, drift space is seen in the vertical plane also because there is no force in the drift space either in the horizontal plane or in the vertical plane. So, matrices in the horizontal plane and vertical plane are seen in the case of drift space. So, in drift space in the vertical plane also we have 1, 0 and we have obtained this matrix of the drift space rooting through the Hilsequation solution and matrices all these kind of thing. But you can verify this very easily using the tip of the matrix how suppose this is a design path or design axis we are measuring the distances and angle with respect to this. This is our coordinate system. So, suppose this is a particle trajectory going in this direction inside the drift space and this is our initial point and this is our final point. So, distance between the final point to initial point is designated as l the length of the drift space. So, at this initial point the coordinates are x 0, x prime 0 and coordinates at the final point is x and x prime. We want x and x prime as a function of x 0 and x prime 0. So, you can see because there is no force the direction of motion will not change for the particle trajectory. So, trajectory's angle will remain constant throughout the drift space means final angle will be equal to the initial angle. So, x prime should be equal to x 0. And in case of x you can easily calculate it calculate that if this is the angle x prime 0. So, this length will be l x prime 0 and then x will be x 0 plus this quantity. So, x 0 plus l x prime 0 and using the matrix you will get the similar thing. So, we have proved very easily that the matrix which we got for the drift space is correct. Now, for the sector dipole magnet again remember that sector dipole magnet is that magnet in which edges have the orientation with respect to descent trajectory. So, that angles between the edges and descent trajectory is 90 degree. At the entrance as well as at the exit so, this orientation of the magnet is known as sector and this is a natural sector of the sector. And also we have no gradient in the magnet in this case k is 1 by whole square we have seen that k is equal to 1 by whole square gradient part is 0. So, now in the matrix which we obtained at every place of k in the horizontal plane we will put 1 by rho is 4. So, under root kl will be l by rho and l by rho is just theta. So, under root kl is the arrangement of the cosine and sine in the matrices. So, in the case of bending magnet in the horizontal plane we get cos theta theta is the bending angle of that magnet rho sine theta 1 minus rho sine theta and cos theta in the horizontal plane. Now, you can see here interesting thing that this element comes with minus sign and what does it mean? It means x will be x prime will be equal to minus 1 by rho sine theta x 0 plus cos theta x 0 prime. Now, you can see minus means it is reducing the initial coordinate with some amount means it is a kind of focusing. It is reducing the displacement with respect to design trajectory as particle passes through the magnet and it is the focusing. This was the geometrical focusing that is why 1 by rho square focusing is known as geometrical focusing in the sector magnet. In vertical plane the dipole sector dipole magnet behaves like the drifted space. So, we have matrix like the drifted space into vertical plane. So, now we have known the matrix of the drifted space a sector dipole magnet now we will obtain the matrix of the quadrupole magnet. In case of quadrupole magnet just put k is equal to gradient normalized by magnetic residue. So, form of the matrix in the focusing plane will be seen as of the original matrix. However, in the defocusing plane we have minus k and minus k. So, under root of k in the defocusing plane will be iota root k means under root k will be iota root k in the defocusing plane. So, in this case the argument of sine and cosine will convert to the hyperbolic functions and hyperbolic function is exponentially growing solution. So, in the defocusing plane we get solution of displacement and angle as the exponentially growing. And this should be because defocusing means the particle is going away and away from the descent trajectory. So, in the focusing plane the matrix is exactly same as we have obtained and in defocusing plane we have hyperbolic functions. If in accelerated jargon we say this is a focusing quadrupole we generally refer to horizontal plane means if a focusing quadrupole means focusing in the horizontal plane it will be defocusing in the vertical plane and defocusing quadrupole means it is defocusing in the horizontal plane and focusing in the vertical plane this is just the convention. Now sometimes we take very very thin element magnetic element in our calculations. So, l tends to be 0. In this case what should be the transfer matrix of this thin magnetic element? Here we will consider thin quadrupole. So, trajectory enters here this is the location of the quadrupole trajectory enters here so as trajectory enters it bends like this. Now you can see here at the entry of the trajectory at this thin lens of element and at the exit. You cannot distinguish x means x at the entry will be equal to x at the exit. So this makes our first row of the matrix so x is equal to x0 and what is this angle? This angle depends on the focal length of this quadrupole which we have seen earlier and that is why in the second row we have 1 by f here and at the diagonals we get 1. So you will get x prime is equal to plus minus 1 by f x0 plus x0 prime. Now you can see that in the case of focusing lens x0 x prime should be negative side means negative with respect to the entry. So this sign should be negative in the case of focusing lens and for the defocusing lens we have to take the positive sign which enhances the angle with respect to the center trajectory compared to the incoming trajectory. So now we have obtained matrices of all the important magnetic elements which we use in accelerators. There are various other kinds of magnets also which we use in accelerator but here in this course we are considering only those magnets under which our equation of motion remains linear. Because I am talking about the linear differential equation I want to put some remarks. So we have d2x by ds square plus k as a function of s x is equal to 0. I am saying that this is a linear differential equation. Now one question may arise that k may be a complicated function of s that k may be k1 plus k2 s plus k3 s square and like that. In this case will it become a non-linear equation? No. Because non-linearity is in the independent variable s here to make the differential equation non-linear we have to have some non-linearity in the x itself which is not there. So under the dipole and quadrupole magnet and using the paraxial approximation our equation of motion remains linear. So whatever we are studying so far is the linear accelerator physics or linear beam dynamics. We will keep ourselves to this domain. Now suppose we have a series of magnets. How these matrices can be used to solve the whole optics or entire optics? Suppose these are two magnetic elements and in between these two magnetic elements there are drift spaces. This is the magnetic drift spaces. And we want to solve this very small optics means two magnets and one drift space. This is our small optics which we want to solve using the method which we have learned so far that is the matrix method. Suppose a trajectory is coming here and this is the entry point of the optics and then it goes like this after the first magnet and after the second magnet it goes like this. So you can say that this is the initial point for this magnet. So this will be designated by column vector x1, x1 prime and this is the final coordinates of trajectory at the exit of this magnet. So this is x2 and x2 prime. We have designated it with x2 and x2 prime. Let the matrix of this magnetic element be m1. So this x2 and x2 prime can be written down as a matrix product of m1 and matrix of the initial condition. So this x2 this is a column vector multiplied by m1 which is a 2 by 2 matrix and x1 which is the column vector of the initial coordinates. Now when we know this x2 using this equation now this vector is known to us and this has become the initial condition for this drift space. So now this coordinate can be obtained using the drift space matrix considering this as an initial condition. So we can get x3, x3 here using the matrix of the drift space and initial condition as this. So now we can get x3 as a function of this if we merge these two equations. If we merge these two equations we will get x3 is equal to x2. Now this is the second magnetic element for this. Now x3A and x3 prime this vector is known to us and this becomes the initial condition for this magnet and we know the matrix of transfer matrix m3 for this magnet. So now we can get x4 and x4 prime means coordinate at the exit of this trajectory of this optics. Coordinates of the trajectory at the exit of this optics. So this will be x4 is equal to m3 x3. At the place of x3 we can put this relation so we get x4 is equal to m3 m2 m1 x1. So it is quite easy, you just have to multiply the matrices of each magnetic element in the correct order and you will get the overall transfer matrix of the optics and if you put initial condition in the beginning of that matrix you will get the final. And in this scale in this manner you can obtain the particle trajectory throughout the optics. So using matrix methods you can easily compute the trajectory. You can write down your own code very simple code of matrix product and just put the matrices of dipole magnet, quadrupole magnet, drift space whatever all the element is coming in between and then using this criteria you can obtain the full trajectory. Now as we have known that by gluing the matrices using the final and initial condition we can get the composite matrix of the optics. Now we come to the wage magnet. What is a wage magnet? Wage magnet already we have seen in one of the examples that the magnet whose age has different orientation with respect to descent trajectory compared to the sector magnet. So had it been a sector magnet the age should be this. But in this magnet we have age like this. So trajectory is not entering at the right angle. So we have here certain age effect which we computed in our previous lectures. And this alpha is the angle with a sector each for this angle. Now if this angle is in this direction we have seen in our example of age effect this will produce a defocusing effect compared to the sector magnet in the horizontal plane. And a focusing effect in the vertical plane. So using a quadri-polar thin quadri-polar type matrix for this age then the matrix of the sector magnet then a thin quadri-polar matrix for the exit age we can get a complete matrix of this wage magnet. So matrix of the sector magnet, matrix of the empty age effect and matrix of the exit age effect. This exit and entry age effect can be modeled as the thin quadri-polar. So this is the thin quadri-polar matrix with focal length like this here the element is 1 by f in the thin quadri-polar. So 1 by f has been replaced by tan alpha by rho which we have computed in our previous lectures. Then this is the matrix of the sector magnet then matrix at the exit. This is again a thin quadri-polar effect due to age. In particular case when alpha is theta by 2 theta is the bending angle we say that this magnet is the rectangular magnet or parallel age magnet this particular orientation is known as. So in this particular orientation we have put at the place of alpha theta by 2 and theta by 2. This is a simple matrix multiplication after multiplication you will get a beautiful result that this magnet behaves in the horizontal plane just like the drift space and the length of that drift space is rho sin theta. Theta is the bending angle and rho is the radius of curvature of the particle trajectory inside this magnet. In the vertical plane the sector magnet has a matrix just like the drift space. So sandwiched matrix is like the drift space and here you can see the effect will be reversed so plus sign has become minus here. Means it is focusing in the vertical plane because this angle is here. If this angle will be here the effect of focusing and defocusing will be reversed and in this case you will get a matrix just like the sector magnet in the vertical plane. This is a very remarkable result that in the case of parallel age magnet horizontal plane is just like the drift space while the vertical plane is just like the sector magnet. So using these matrices we can compute trajectory through the complicated magnetic optics very easily. And what the solutions we are getting in the form of cosine plus sign these are the principle solutions of that differential equations. So if we will take initial condition like x0 is equal to unity and x0 prime is 0 then you have cosine like solution and if you choose the initial conditions like x is equal to 0 and x prime is equal to unity then you will get the sine like solution and all other solutions or trajectories will be the linear combination of these solutions which we have seen and because of the linear nature of these dynamics the matrices can be written down and this provides a very powerful tool for computing. You can consider these matrices as the operator. So each matrix has an operator of the associated magnet and it operates on the initial condition and you get the final condition. References are same and each book on accelerator physics covers nicely these matrices in the accelerator physics. So you can go through these books to go into the details of these matrix calculations. In the next lecture we will see another way of solving the L-situation. This was the matrix method and another way is they also exist and we will see that method in the next lecture.