Look at the image above here the point P4' is the image of the point P4
If the light ray reaches the point P4 after getting bounced from the mirror then the light ray would have reached the point P4' when there will be no mirror.
So, just generate n images of the given n points and remove the mirror.
Then our problem would be reduced to find the value of θ such that the light ray would cover the maximum number of points in its path.
This could be solved with the help of the algorithm written below.
1) Take an array A[2n]
2) Calculate the angle made by each point with the x-axis which will be tan-1 (y/x) and store the value of the angle made by the point Pi in A[i]. This would take O(n) time.
3) Sort the array A. This would take O n(log n) time.
4) Find which angle in the array A is repeated maximum no. of times and return that angle this would take O(n) time.
Thus our whole algorithm would take O n(log n) time.