A line passing thruogh the point P and havinf the slope m has the equation
The line must intersect the circle in a single point, so the system of equations formed by the equation of the line and the equation of the circle must have only one solution.
Replace y in the equation of the circle and you'll find a quadratic equation:
This equation must have equal roots. For this, the discriminant must be 0.
Replace m in the equation of the line with these two numbers and you'll find two tangents line to the circle.