Swaps are contracts that transform one kind of cash flow into another. A plain vanilla swap transforms a fixed interest rate cash flow into a floating interest rate cash flow. A commodity swap, swaps or exchanges floating price for the commodity for a fixed price for the same commodity. Examples include, gold swaps, oil swaps, and so on. Currency swaps allows you to swap a cash flow in one currency for a cash flow in another currency. So, why do companies construct or entities construct swaps? They do because you want to change the nature of cash flows. The example is fixed interest rate versus floating interest rate. Another possibility is to construct swaps to leverage strengths in different markets. Here's an example. Company A, were it to borrow in the fixed interest rate market, would be charged four percent per annum. If it were to borrow in the floating rate market, it would have to pay LIBOR plus 0.3 percent. LIBOR stands for the London Inter-bank Offer Rate, and that's the rate which is used as the base for coating floating rate, interest rates. Company B, were it to borrow in the fixed interest rate market would be charged 5.2 percent, and in the floating interest rate market it could borrow at LIBOR plus one percent. So, company A is clearly superior to company B, both in the fixed interest rate market as well as the floating interest rate market. However, company B is relatively stronger in the floating rate market. The difference between the rate for company A and B is only 0.7 percent in the floating rate market, whereas it's 1.2 percent in the fixed rate market. So, these companies could take advantage of the difference of their relative strengths in the two market to create an instrument which lets them borrow at a better rate than they could have individually borrowed in either of the two markets. Company A which is stronger in the fixed rate market, borrows in the fixed rate market. Company B which is stronger in the floating rate market, borrows in the floating rate market. Then they construct a swap in order to make an additional product or a derivative product which is going to be better than each of these individual deals that are available to these company. So, here's company A. It borrows at four percent, which means that it's going to pay out four percent. Here's company B, which borrows at LIBOR plus one percent. Then they construct a swap, where company A pays company B LIBOR, and company B pays company A 3.95 percent. If you see what the net effect of this swap is to each of these companies, company A now ends up paying LIBOR plus 0.05 percent, which is better than what it could have borrowed in the floating rate market. Company B ends up paying 4.95 percent, which is better than what it could have gotten in the fixed rate market. So, by constructing the swap, these two companies are able to leverage their relative strength to get a deal which is better than what they could have achieved in either the fixed rate market or the floating rate market. Both of them end up gaining. The details of how the 3.95 percent gets set depends on supply and demand. But there is an implicit assumption that is being made in this particular example, and that's that company A and company B continued to exist. That neither of them is going to default. If one of these companies were to default, then this entire superstructure breaks down. Company A or company B, depending upon which one has a default, will be exposed to a big risk. So, most of the times when swaps are constructed, you don't make a swap with a counter party directly because you don't want to be exposed to the counter party default risk. You would rather make it with an intermediary, a financial intermediary that is able to take on the counter party risk, and guarantees you that you will get the swap cash flow that you're expecting to get from the counter party. So, here's how these swaps get set-up. The same two companies, A and B, and now there's a financial intermediary that constructs the swap. Company A borrows in the fixed rate market at four percent swaps with an intermediary and pays LIBOR and receives 3.93 percent. So, 0.02 percent less. Company B borrows in the floating rate market at LIBOR plus one percent. Construct a swap with an intermediary, receives LIBOR and pays 3.97 percent. So, 0.02 percent more. This is the same thing as saying two basis points less, two basis points more. The financial intermediary in the middle makes this 0.04 percent. It receives two basis points from company A and receives two basis points from company B. Why does it get that? This is the compensation for taking on the counter party risk. If either of these two companies default, the financial intermediary is on the hook to provide the cash flow necessary for the surviving party. Also constructs a service. In the sense that, typically, in the market company A and company B don't know that they exist. Their relative strengths are different. So, by creating a swap, they would be able to better position themselves. The financial intermediary is able to bring these two parties to the table and construct a swap that's going to be mutually beneficial, and ends up getting paid for providing the service. How do you price these swaps? So, we'll give you an example of how to price interest rate swaps. So, let rt denote the floating or random unknown interest rate at time t. Let's construct an interest rate swap, where company A which goes long on this swap, receives some notional principal N times rt minus one. So, at time t, it receives a notional principal times the random interest rate which is prevailing at the time t minus one. It pays the same notional principal N times a fixed interest rate X. Company B which takes on the short position, receives the fixed interest rate payments, N times X and pays the floating rate payments N times rt minus one. What's the value of the swap to company A? It's going to be the cash flows associated with the floating rate bond. So, let's see how an interest rate swap is priced. Let rt denote the floating unknown interest rate at time t. Let's consider a swap whose cash flows at time little t equal to one through capital T, is given as follows. Company A, which takes on the long position in the swap, receives a notional principal N times the random interest rate prevailing at time T minus one. So, the cash flow that it receives at time T is given by the notional investment and notional principal N times the interest rate at time T minus one. It pays the same notional principal N times a fixed interest rate X. Company B, which nominally takes on a short position on the swap, receives the fixed interest rate payment N times capital X, and P is the floating payment N times rt minus one. Now, what we want to do is compute the value of the swap to company A. So, there are two pieces to the cash flow to company A. It receives the cash flow to principal N times r_0, r_1, r_2, and so on up to r capital T minus one, at times 1, 2, 3, 4 up to capital T minus one. This is precisely the cash flow associated with a floating rate bond minus the face value. So, in a floating weight bond at the expiration capital T, in addition to the coupon payment, you would have received the notional principal back. This time you do not get the notional principal and therefore, the value of the swap to company A, consists of two elements. This is the value of the floating rate payments received. This is the value of fixed rate payments paid to company B. We know that the value of a floating rate bond is directly equal to the principal, but we don't get the face value back. So, I have to subtract from that value N times d0, t which is the discounted value of the principal which was received at time capital T. What happens to the value of the fixed rate payment? Every period I get N times X, I have to discount that from time t equal to one to capital T. So, this is simply the discount values. How is this X set? This X set, in a similar manner as we have done for forward contracts. We set it at a value such that the VA is exactly equal to 0 at time T equal to 0. If you set it up, VA equal to 0 implies that X must be equal to 1 minus d0,t divided by the sum of little t, going from one through capital T, d0,t. This is the interest rate that you would have to set up, so that the value of the swap is exactly equal to zero for company A, and it's also equal to zero for company B. So, the two companies going into this swap are indifferent between taking a long position or a short position.