# The number of people voted in an Instagram poll

Instagram provides a polling feature, which allows the user to ask a question with two answers to the audiences. Once an audience pick one of the two answers, the percentage of users who pick each answer is displayed.

So the questions are: how many people actually voted in the poll? How many people voted for each option?

I believe mathematical modelling of the voting process can provide an answer to these questions.

Update: there is a now a new solution to this problem.

## Mathematical model of Instagram's polling feature

The Instagram poll can modelled using the following vector equation:
$$poll(a,\ b) = \Big(nint(\frac{100a}{a+b}),\ nint(\frac{100b}{a+b})\Big),$$

where $a$ and $b$ are the number of audiences picked each of the option. $nint$ is the nearest integer function, such that $nint(x)$ is the nearest integer to $x$. The domain and the codomain of $poll(a,\ b)$ is: $\mathbb{N}_0$. The range for $poll(a,\ b)$ is $0 \le x \le 100$.

## Solution strategy

It is clear that $poll(a, b)$ has many-to-one mapping. This means that it cannot have an inverse function. The range of the function is quite small, and the actual input of the function tends to be quite small. It is therefore a good strategy to build a look-up table by exhaustively enumerating all results produced by all possible combination of $a$ and $b$, up to a certain size limit.

## Matlab implementation

I wrote the following Matlab functions to generate the look-up table and perform the search. The function IPRL takes two parameters - the number of audiences picked one option, and the maximum potential number of participants in the poll. This function gives a list of potential number of participant in the poll.

function [x] = IPRL(yes, total)
%IPRL Instagram Poll Reverse Lookup
%   Parameters :
%    - yes : the number of audiences selected one of the options
%    - total : the maximum potential number of audiences participated in the poll
tbl = GenTable(total);
[x, ~] = find(tbl == yes);
end

function [tbl] = GenTable(n)
%GENTABLE Generate the look-up table
tbl = zeros(n);
for i = 1:n
for j = 1:i
tbl(i,j) = round(j/i, 2) * 100;
end
end
end

### Example scenario

I saw a poll with 27% of the users picked one option, and I suspect that maximum 30 users participated in the poll, so I run:

>> IPRL(27,30)
ans =
11
15
22
26
30

Then I get a friend of mine to vote in the option that had 27%, and now it changes to 33%.

>> IPRL(33,30)
ans =
3
6
9
12
15
18
21
24
27
30

It is clear that after I first voted, the number of participants could have been either 11 or 26. After my friend voted, the number of participants could have been 12 or 27. The idea is that the second look-up should produce numbers that have increased by 1, compared to the first look-up. However from personal experiences, none of my Instagram poll ever broke the 20 participant barrier, therefore 12 participants voted in it.

## Other Strategies and Future Improvement

Perhaps I can record how the how the percentage number change over time, and automatically give a list of the most likely number. The number of participant monotonically increases over time. This property can help the search. Perhaps I can write a function that automate this process.

Finally, it would be great to implement this whole idea using Javascript, so people can run it without Matlab.

## Ethical Consideration

Well, if you do not want people to find out how many people have voted in your poll, do not do an Instagram poll. This work does not gather more information than what is already in the public.

## Acknowledgement

I came up with this idea, after seeing an Instagram poll from the girl who gave me a toblerone. So, thank you for the inspiration. • public/the_number_of_people_voted_in_an_instagram_poll.txt
• by fangfufu