# how to calculate similarity between users based on movie ratings

Hi I am working on a movie recommendation system and I have to find alikeness between the main user and other users. For example, the main user watched 3 specific movies and rated them as 8,5,7. A user who happened to watch the same movies rated them as 8,2,3 and an another user of the same kind rated those movies as 7,6,6 and some other user only watched first two movies and he rated them as 8,5. Now the question is to which user the main user is close. I tried to come up with functions, but they are prone to fail. Can you help me?

• In low dimensions (here you have 3) you can try Euclidean distance to rank similarity. I.E. sqrt((8-8)^2 + (5-2)^2 + (7-3)^2) to check the similarity between the main user and the first one in your example. May 7, 2021 at 2:41
• @Zwang what about third user sir? May 7, 2021 at 3:32

$$d(p,q) = \sqrt{\sum_{i=1}^{n}(q_i - p_i)^2}$$