Home Blog About

What are the odds of getting hired? Jobs, chess, and polynomials

If you are a new graduate like me, there is a good chance that you are having trouble finding a place to start your career. There are quite a few of us in the market right now, and due to the pandemic, fewer available jobs than normal. Among the endless applications, resume revisions, and LinkedIn searches, quite a few of us have begun to wonder: what are our odds of getting hired right now?

An overview

I asked myself this question recently, and having taken a combinatorics course in my undergrad, could not help but explore it mathematically. Before moving on, I do want to say that this will not be a proper statistical analysis of the hiring process during lockdown. It will, instead, be an exercise in solving an interesting combinatorial problem, and developing a useful model of the job market.

First, as a refresher, we may estimate the probability of an event through a sequence of fair trials by using the formula

Where is the probability of , is the number of times that the event occurred in the trials, and is the total number of trials.

In our question, we want to know what the odds of getting hired are. Our event is you, or me, or any single individual getting hired for any job. The trials are ways, after the dust has settled, that companies have hired people.

Initially, this problem might seem simple. Let’s introduce John, who is applying for a job as a software engineer at a large tech firm. John is not the only person interested in this job, and is competing with 49 other people for this one position. If we ignored interview performance, personality, and other interfering factors, we could easily calculated John’s probability of being hired to be , or . However, the world of job hunting is not this simple. John likely applied to other jobs as well, to increase his own odds of being hired, as did those 49 other people. Further, John may be competing with some of the same people for those other jobs, meaning that if they got hired for those other jobs, his odds with this first job would actually increase, since they would no longer be in the pool of applicants.

As it turns out, this problem is much, much more interesting. The event is of John being hired. We will use two symbols, , and to represent the number of ways in which John has been hired, and the total number of ways that jobs may be distributed, respectively. Then we arrive at the following formula:

We need to figure out how to develop a model which can tell us what and are. We arrive at a combinatorial question: how can we count the ways that jobs can be distributed? To answer that, we first need to talk about chess.

Counting rooks

Let’s start by asking a related, but different question: how many ways can you place non-attacking rooks on a chess board?

In chess, a rook ♖ may attack pieces above, below, and to its sides. For a rook to be non-attacking, these areas must be clear of any other pieces.

Two attacking rooks
Two non-attacking rooks

Initially, this is a simple problem. If we place a rook, we eliminate the ability for us to place a rook in that row or column. If we iteratively choose rooks from free spaces left on the board, we notice a pattern. The first rook eliminates 15 spaces, the next rook 13 (since two were already eliminated by rook 1), the next 11, and so on. If we describe the number of ways to place the rook, we get the sequence, , described by . Then, our desired function, the total number of ways to place rooks, is

Further reductions are left as an exercise to the reader.

Importantly here, we notice the recursive nature of solving this problem. While we could view each decision to make as a function of the previous decision, we could also notice that each rook placement essentially leaves us with a smaller, but still square, board. For each rook we place, we are simply choosing from progressively smaller boards. Our problem is recursive: each successive rook placement can be seen as its own small version of the larger problem.

This so far has been a relatively simple problem. However, one might start thinking about how to generalize to non-standard boards. Before then, though, let’s get back to John, who is still just trying to find a job.

Getting hired is a game of chess

As a reminder, we are trying to count the number of permutations of hirings that allow John to be hired, and the number of permutations of hirings in general. We’ll tackle that second part first.

Let’s first examine a much smaller and simpler version of this problem. Let’s say that John, being a generalized software engineer, is applying for three different positions: front end developer, AI developer, and compiler engineer. Unfortunately for John, he is not alone. Faye, Elliott, Lee, and Maria are also looking for jobs, and have also applied to some of these jobs.

A way to visualize various job applications

Let’s assume that there are no applicants for any of these three positions, or the additional full stack position. How can we even begin to count the ways that these jobs may be distributed? We will make a chart, relating positions and people. We darken out any position that a person did not apply for.

What happens when a person is hired for a position? Well, not only do they celebrate with take out pizza, a glass of champagne, and a few too many Oreo cookies, but they also remove themselves and the job from the market. For example, if Elliott were to be hired as an AI developer, we would oberve the following change to the chart.

Hmm, this pattern seems familiar. Might we have seen something similar before?

As it turns out, match people with jobs reduces easily to the same problem of placing rooks on a chessboard! As such, we can rephrase our question of “how many ways can jobs be distributed” into something involving the placement of rooks on this board. We will call this chessboard .

In a perfect world, we would assume that everyone would coordinate to maximize the number of hirings. In this case, we would ask for the number of ways to place the maximum possible number of rooks on this board. However, it is not a perfect world - sometimes jobs close, people pull themselves off the market, and competing jobs poach each others’ choices. As such, we instead need to count every possible hiring permutation - that is, counting every case which could even be considered remotely possible, including a case where nobody is hired at all. So, our question becomes “how many ways can we place any number of rooks on this board?”.

However, now we need to find a way to deal with these “darkened” spaces.

Polynomials

When dealing with permutations of various indistinct items (rooks), a common combinatorial tool is to encode the problem in a polynomial, called a generating function. That is, we change from a question of “how many are there?” to “what is the coefficient of in the polynomial ?”. In this case, we will introduce a function which yields the “rook polynomial” for our board, .

So, what do we get from using polynomials to encode our problem? The answer lies in how polynomials can be composed and combined with each other. We will find several important uses of polynomials as we break down into something countable.

Changing the board

Initially, counting rooks on this board is difficult, and tedious to do by hand. It is better to break the problem into smaller parts, which are more feasibly counted.

A nice feature of rook placements is that they only interact with the squares directly above and below them. Knowing this, we can transform the board, as long as we don’t alter the alignment of columns and rows. We can then swap any two rows or columns of the board as many times as we need, and it will not affect our count of rook placements. We have used this property here to transform into a board with two isolated corners of valid spaces.

\(B\) rearranged

What did we get from doing this? Well, there are now two nearly non-interacting sub-boards By non-interacting, I mean that a rook placement on either of these smaller boards has no effect on rook placements on the other board. We will call these sub-boards and .

\(B_1\) in red, \(B_2\) in blue

It is much easier to count rooks on these smaller boards, and the non-interaction will be key in our ability to use these simpler counts for the larger board. For now, we will not worry about the two squares lying outside of these two subboards, and will simply use the larger board for many of the counts here.

The board \(B^{\,\prime}\)

Counting coefficients

Let’s find the rook polynomials and . As stated above, this will be done by encoding the number of ways to place rooks on the board as the coefficient of .

On board , we have a trivial 2x2 square. We can easily count that there are ways to place one rook, and ways to place two rooks. We also must count the single way that there is to place no rooks. Note that there are no ways of placing three or more rooks, so these coefficients in the polynomial will be , and are not written. We have now arrived at our polynomial:

We can similarly easily perform the counts for , and arrive at the second rook polynomial:

How are these useful in counting the larger board and its equivalent board ? The non-interaction is key here. Think about a single count of rooks, like . When placing rooks on the larger board, how would rook placements on these sub-boards contribute to that count? In this case, there could be rooks from and rooks from , rook from and rook from , or rooks from and rooks from . Then, the coefficient for in the polynomial for the larger board, , is the sum of the number of ways to place those two choices. But this is just how we calculate coefficients when we multiply two polynomials. Thus, we can say that

We now have a way to derive our larger polynomial from the two smaller ones! This is, of course, still ignoring those two outlying white squares. How about we deal with those now?

Eliminating outlying squares

We will eliminate those outlying squares by investingating two disjoint cases: when a rook is placed on the square and when a rook is not placed on that square. First, we will eliminate the top right outlying square in , highlighted below.

We will work to eliminate the square highlighted in red

Let’s construct two boards, and which represent with and without a rook placed on the square, respectively. If the square does not have a rook, then we simply may darken it out. If the square does contain a rook, then we must darken both it, and its row and column, since after placing a rook there, all spaces in the row and column are now not valid for rook placement.

Board without rook placed, \(B^\circ\)
Board with rook placed, \(B^\bullet\)

Again, we will ask how we can construct the rook polynomial for using the polynomials for these altered boards. Let’s just ask what these respective polynomials represent, firstly. tells us how many ways we can place a number of rooks, with none being on the indicated square. One would think that would conversely count the number of rooks with one on the indicated square, but this is not so. It does not encode how many ways you can place rooks after the initial rook has been placed, but it does not count that initial rook. However, does, since it raises the number of rooks encoded in every coefficient by . But now we are done, since we have counted all of the rooks in the two disjoint cases which together make up all of the ways to populate rooks in . We now have a complete formula for in terms of these two altered boards:

Putting it all together

We are now equipped with all of the tools that we need to construct the polynomial and find the number of ways that we can distribute jobs among these applicants.

\(R(B_1, x) = 1 + 4x + 2x^2\)
\(R(B_2, x) = 1 + 5x + 4x^2\)
$$ \begin{align*} R(B^{\circ\circ}, x) &= R(B^{\,\prime}, x)\\ &= R(B_1, x) \cdot R(B_2, x) \\ &= 1 + 9x + 26x^2 + 26x^3 + 8x^4 \end{align*} $$
\(R(B^{\circ\bullet}, x) = 1 + 5x + 7x^2 + 2x^3\)
$$ \begin{align*} R(B^{\circ}, x) &= R(B^{\circ\circ}, x) + x R(B^{\circ\bullet}, x)\\ &= 1 + 10x + 31x^2 + 33x^3 + 10x^4 \end{align*} $$
\(R(B^\bullet, x) = 1 + 5x + 6x^2 + x^3\)
$$ \begin{align*} R(B, x) &= R(B^\circ, x) + x R(B^\bullet, x)\\ &= 1 + 11x + 36x^2 + 39x^3 + 11x^4 \end{align*} $$

So, we have finally reached our desired rook polynomial, . Now we need to return to our original problem statement - counting ways to distribute jobs.

Distributing jobs

We now return to our original question: what are the values of the number of job distributions in which John is hired, and the number of ways to distribute jobs among these applicants? Our polynomial has all the information that we need. Since each coefficient of in the polynomial represents the number of unique ways to distribute jobs, and each of these counts is unique among each other, we can find the total number of ways to distribute jobs by summing all of the coefficients in the polynomial. Formally, we write

Now, all that is left is to calculate .

Getting John hired

Fortunately, we are well equipped with the tools needed for this last task. Actually, the way that we will calculate is similar to a technique that we used earlier to simplify our board. We will place a rook on each of the open spaces in the row representing John, and then count the number of ways to place any more rooks on each of those boards. The sum of all these counts will be .

All of the boards resulting from John being hired, with the hired position marked by a rook

We are now able to see the rook polynomials for these boards, finding them to be , , and respectively. Summing up the coefficients, we calculate :

The answer (for John)

Now the we have found the values of and , we return to our original formula for , the probability of John being hired in this job market.

The answer (for the rest of us)

What we have created here is a model of the job market. It is limited in the fact that it cannot assign weights to certain people to be favored in one job over another, and it counts all scenarios equally. However, it has been a fun and useful exercise in using combinatorics to model discrete problems, and in thinking a little outside of the box, mathematically.

Can you apply this model to yourself and the real world job market? No, as you have neither the information nor the computing ability to be able to build a board out of every job and person competing with you. Still, it is through abstract thinking like that applied here that we can develop more complex and precise models of the real world.


Thank you for reading.

I hope that, if anything, this approach has left you with some curiosity for other combinatorial problems and their solutions. If you are interested further, I would suggest picking up Alan Tucker’s Applied Combinatorics, the textbook used in my university combinatorics course. There are quite a few interesting problems, and unexpected connections to other areas of mathematics.