‫Welcome back.
‫So let's start with the derivation then, or to be more precise, a recap of the derivation.
‫So this is the screenshot from the previous course.
‫And then what I'm going to do here, I'm going to replace this delta with a U.
‫And also this delta here with the U.
‫So it's going to be Delta U at Karplus I vector and then here Delta U at K plus I vector transposed.
‫Now in our case, in the other case, the horizon period and therefore end equals four.
‫Then here in green you replace the error variables that are here inside the parentheses.
‫So here again, I'm going to replace this delta with a U.
‫And here as well, this is going to be Delta U at K plus I and here Delta you add K plus I transposed.
‫And so when you took this thing here, this parenthesis which was transposed, then you could write
‫it out like this, like we did it in the previous course.
‫So this is a screenshot from the previous course is the same thing.
‫The only difference now is that inside your reference vectors and augment state vectors, you have different
‫variables there and also the dimensions of the matrices, like Kielder, for example, they are different.
‫And also instead of Delta deltas, you have Delta use here.
‫And so when you have this expression transposed, then what you can do, you can rewrite it like this,
‫where you distribute this transpose sine among both terms.
‫And then here, when you open up this parenthesis with this transpose sine, then according to linear
‫algebra, this augment is state vector.
‫That was the second variable here.
‫It will be the first variable here and then the C tilde, it will be the second.
‫And also both of them will be transposed as well.
‫Right.
‫And then you took this entire first term here in purple and then you rewrote it like this.
‫You simply open up the parentheses and that's it.
‫Since your s matrix here was diagonal, you could rewrite this thing like this, which was exactly the
‫same term, like this one here.
‫And then you could put them together.
‫And then that means that this one half here and one half here would disappear.
‫And now, since you have rewritten this term here that I have encircled with this purple line, since
‫you've been able to rewrite it like this, then you could rewrite the entire cost function in this form
‫where I'm just going to make a small correction instead of Delp.
‫I'm going to put you here and also here instead of Delta.
‫I'm going to put you here.
‫So Delta you at K plus I vector and here the same thing only transposed.