Plagiarism is representing someone else's work as your own or copying another's work or borrowing someone else's original ideas.
Cosine similarity is used in information retrieval and text mining. It calculates the similarity between two vectors. If you have two documents and want to find the similarity between them you have to find the cosine angle between the two vectors to check similariy.
Let’s say you have two documents. The best way to check whether both documents are similar or not is to find the cosine similarity between each document. Its value is between -1 and 1. If the value is 1 or close to 1 then both documents are the same and if it is close to -1 then documents are not the same.
Suppose you have a large number of documents then using the information of cosine similariy you can cluster documents. This helps you to find relevant information about documents.
Get the similarity between each pair of documents and return similarity score of them.