# Calculate Pagerank of three nodes

Soon I will have an exam where I will be asked to calculate pagerank. So far, I have been thought to use power iteration. However, this can be a very expensive operation to do during an exam, especially when most of the times, the number of nodes is just 3.

Is there any better algorithm to calculate the pagerank of only 3 websites involved?

There is a formula for the PageRank which involves inverting an $n\times n$ matrix. When $n = 3$ this is not too hard. For inverting the matrix, use the formula given on Wikipedia, which is just a special case of the general formula involving the adjugate matrix.

That said, I see absolutely no reason why you would ever have to calculate PageRank by hand. That's what we have computers for. If you are given such an exercise in an exam, the matrix will probably have some very simple structure which will make it easier to handle by hand.

• sorry Yuval, I have gone through it again. I think inverting the matrix will lead to yet another linear system to solve. Isn't there any 3x3 property that I am not seeing? – revisingcomplexity May 4 '15 at 13:43
• Use the formula here: en.wikipedia.org/wiki/PageRank#Algebraic. When you're inverting a matrix, you're solving a linear system. – Yuval Filmus May 4 '15 at 13:48
• Can you give some other hint on that, I am confused how I construct the stochaistic matrix – revisingcomplexity May 4 '15 at 13:55
• No, now it's time for you to revise the material on your own. Good luck! – Yuval Filmus May 4 '15 at 13:56
• I don't think there is a need for finding the inverse, if I can just use the transpose and solve the linear system. My aim is to avoid that – revisingcomplexity May 4 '15 at 14:09

A less formal answer, but nice step by step strategy is described in this video

• After a bit more learning. this is equivalent to solving a linear system – revisingcomplexity May 7 '15 at 9:55