hiiiiiiiiii
saurabh is right,but there can be one more way also.
just use distance formula.
in

ABC cosB=(a
2+c
2-b
2)/2ac
use this formula to calculate the cos term
solution:
OP1=sqrt(x12+y12)
OP2=sqrt(x22+y22)
cosP1OP2=(x1x2+y1y2)/sqrt(x12+y12)sqrt(x22+y22)
I have taken a=OP1 ,b=P1P2 c=OP2
P1P2=sqrt((x1-x2)2+(y1-y2)2)2
so now u'll get the answer