Let's look again at the stiffness matrix that we need to calculate for each element Kij which is actually an integral from minus one to one over terms that contain the stiffness and the derivatives of the Lagrange polynomials. Now, our numerical integration scheme allowed us to turn this into a sum, and the sum is going from k to n plus one, where n is the polynomial order and inside the sum, we have actually the integration weights W which we know. They are given. We can get them from a table. But we also have the derivatives of the Lagrange polynomial and they will be evaluated at psi k. So, what remains to be done before we actually put everything together and come up with a solution algorithm for the spectral-element method, we need to find a way to calculate the derivatives of the Lagrange polynomials at our co-location points psi k and that requires so-called Legendre polynomials. Let's first show the result. It could be a long derivation, but let's not do that. We'll show you the results here as it's implemented in our Python code. So, we need to calculate the derivative of the kth polynomial of L at points x i i. It turns out it's a sum over a matrix d i j, multiplying the Lagrange polynomial K at point psi i, and what remains to be done is actually to find the matrix d i j which can actually be found in the literature. That paper is given here, and this equation actually then returns in matrix form the derivative of polynomial k at point i. So, there will be a subroutine. I will calculate that. We return it and then we can use it and calculate the stiffness matrix. So, the specific form of the matrix d i j is given here, and as you can see, it contains capital L, the Legendre polynomials, and we look quickly at the Python code as it is actually implemented. That Python code returns the matrix d i j and you can see it here, and it has also a function that we defined in our Python code called Legendre. So, we need to first step back and ask the question, what are the Legendre polynomials and how can we calculate them in order to eventually calculate also the matrix d i j? So, what are the Legendre polynomials? The equation looks quite complicated and it's given here. The Legendre polynomials are actually again used very widely particular in quantum mechanics and all fields of mathematical physics. So, let's investigate a little further Legendre polynomials before proceeding. Even though the equation for the Legendre polynomial looks very complicated, they're actually quite simple to calculate because there is a simple recursive formula that you see here, that can be used to calculate them, and look at the simple Python code as well here. That returns these Legendre polynomials and that can be used and actually to calculate the entries to the matrix d i j that we use to calculate the first derivative of the Lagrange polynomials. Now, I'm sure you're curious what the Legendre polynomials look like, and here are the first couple of polynomials illustrated in this graph, and again it's worth saying that they are really used in much of mathematical physics. So, I'm sure you will encounter them again. But basically, we can conclude here, we now have everything, all these little things we need to calculate the mass matrix. We know the integration weights. We know how to interpolate a function using Lagrange polynomials. We have everything. Now, let's put these things together and come up with the final solution scheme for our spectral element method.