In ur question ,
P1(x1,y1) and P2(x2,y2)
OP1= sqrt(x12+y12)
OP2 =sqrt(x22+y22)
slope of OP1 (m1)= y1/x1
slope of OP2 (m2)= y2/x2
tan (P1OP2) = (m1-m2)/(1+m1m2)
cos(P1OP2) = (1+m1m2)/(sqrt((m1-m2)2+(1+m1m2)2))
OP1.OP2. cos(P1OP2) =sqrt(x12x22+x12y22+y12x22+y12y22) . (x1x2+y1y2)/
sqrt(x12x22+x12y22+y12x22+y12y22)
Therefore , OP1.OP2.cos (P1OP2) = x1x2+y1y2