Trust is context-dependent. In real-world scenarios, people trust each other only in certain contexts. However, this concept has not been seriously taken into account in most of the existing trust prediction approaches in Online Social Networks (OSNs). In addition, very few attempts have been made on trust prediction based on social psychology theories. For decades, social psychology theories have attempted to explain people’s behaviors in social networks; hence, employing such theories for trust prediction in OSNs will enhance accuracy. In this paper, we apply a well-known psychology theory, called Social Exchange Theory (SET), to evaluate the potential trust relation between users in OSNs. Based on SET, one person starts a relationship with another person, if and only if the costs of that relationship are less than its benefits. To evaluate potential trust relations in OSNs based on SET, we first propose some factors to capture the costs and benefits of a relationship. Then, based on these factors, we propose a trust metric called Trust Degree; at that point, we propose a trust prediction method, based on Matrix Factorization and apply the context of trust in a mathematical model. Finally, we conduct experiments on two real-world datasets to demonstrate the superior performance of our approach over the state-of-the-art approaches.