User Tools

Site Tools


public:the_number_of_people_voted_in_an_instagram_poll

This is an old revision of the document!


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.

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

function [x] = IPRL(yes, total)
%IPRL Instagram Poll Reverse Lookup
%   Detailed explanation goes here
tbl = GenTable(total);
[x, ~] = find(tbl == yes);
end
 
function [tbl] = GenTable(n)
%GENTABLE Generate Instagram Reverse Lookup Table
tbl = zeros(n);
for i = 1:n
    for j = 1:i
        tbl(i,j) = round(j/i, 2) * 100;
    end
end
end
public/the_number_of_people_voted_in_an_instagram_poll.1555074252.txt.gz · Last modified: 2019/04/12 13:04 by fangfufu