# How does math help Yandex make money?

Yandex makes hundreds of millions of dollars a year, although our search is free. We get the main income from advertising, connecting sellers with buyers. To do this well, we use sophisticated algorithms based on mathematical statistics, probability theory, machine learning, game theory, and auction theory. An improvement in algorithms by only a few percent is an additional tens of millions of dollars a year. In this lecture you will learn how mathematics can work in advertising.

#### What do advertisers pay for?

There are several payment options for placing advertisements on the Internet. The simplest and most profitable model for an advertising platform is CPM (cost-per-mille - payment per thousand impressions). It implies that payment is solely for the display of ads on search results pages. At the same time, the site is not responsible for how well the advertising was targeted, whether users liked it, and whether the advertiser brought any profit. Accordingly, for the advertiser such a model is not very profitable, and is not particularly popular.

Another model is CPA (cost-per-action). It implies that the advertiser pays only if he has achieved the desired result, for example, selling a product or service.

This is extremely beneficial for the advertiser, because he pays only if he makes a profit. An ad site within this model may have some difficulties. Indeed, even if the advertisement was correctly targeted, the user became interested in a product or service and went to the advertiser's website, it is not necessary at all that the purchase will be completed immediately. The user can return later, or make an order by phone.

The third model is PPC (pay-per-click), pay per click. We can say that this is some kind of golden mean, equally beneficial to both the site and the advertiser. The advertiser can be sure that his ads will be shown to users who may be potentially interested in them, and the site avoids the difficulties of fixing the conversion. This model is mainly used in Yandex.

In Yandex, the main advertising targeting is based on a user’s request. Suppose a user entered a query [plastic windows in Rostov]. When an ad is submitted, advertisers indicate for which keywords in the request they would like to show it, and for which they haven’t. But even in this case, it may turn out that there are too many candidates for the show, from among which the most suitable ones must be selected.

#### Which is better to show?

Let's say we have one ad slot on the issuing page. Based on the request, we compiled a list of candidates for the show and selected the three best ads from them. The first has been shown 1000 times, and gained 100 clicks. The second one showed up 500 times and also collected 100 clicks. And they clicked on the third 300 times for 10,000 impressions. If we estimate the probability of clicks, then it will be 10%, 20% and 3% for each of the ads, respectively. Obviously, the second ad is most effective on a user-entered request. Those. provided that all three advertisers pay the same amount per click, then displaying a second ad will be most beneficial.

But the bid per click may be different. For example, let’s say the first advertiser set the pay per click to \$ 0.3, the second to \$ 0.1, and the third to \$ 2. In this case, the profitability of placing each of the ads changes. Multiplying the probability of a click on a bet, we get the following amounts: for 1000 impressions of the first ad, the site will earn \$ 30, the second \$ 20 and the third - \$ 60. Accordingly, the display of the third ad becomes more profitable. This is a very simplified model, but it allows you to understand how everything works.

#### How much to write off?

How to determine how much money to take per click? After all, the profit from it for each advertiser can be different. The most obvious option is to arrange an auction, then it will become clear how much advertisers are willing to pay for displaying ads on demand with certain keywords. However, a regular auction in which competitors raise the price and, as a result, who has offered the highest bid, pays for it, due to some features of the system it is disadvantageous for both parties. Therefore, the second price auction is used, where the bidder also wins, but he pays as much as the previous bidder.

Typically, an advertiser has a rough idea of ​​how much each click on an ad is worth to him. If we accept the value of the click as v, and the bid as b, then b should always be less than or equal to v, because otherwise the click will not bring any benefit to the advertiser. The most profitable strategy for advertisers in such an auction is to honestly set the value of b equal to the value of v. This is easy to prove with the help of auction theory.

Let's say two advertisers compete for placing an ad on one of the ad slots. One of them bets b, and the second bets b '. The price that the winner will ultimately pay is denoted by c, and it will definitely be less than the value of b set by him, because its value is taken from the bet of the losing participant. The winner’s profit (denoted by s) can be calculated using the formula s = p (v - c), where p is the probability of a click on an ad when it is displayed. Now we prove that it is most beneficial to set b to v. It’s not profitable for the advertiser to set b> v initially, so we’ll consider the scenarios for b <v. If b 'is greater than v, then the participant who placed b loses and receives no profit. In this case, there is simply no way to win against a participant with bet b,

And if b 'is less than v, but more than b, then the first participant loses again, although he had the opportunity to win, put b equal to v. If b is greater than b 'but less than v, then c will still be equal to b', as if b were equal to v. Thus, with b <v, the probability of winning the auction is less, and the final price as a result of winning will still be equal to b '.

After watching a lecture, you will also find out why in such a seemingly simple matter as advertising you need such complex things as machine learning and distributed computing.