If y=x+2 is tangent to the circle with center O(2,-1), the radius of the circle is equal to the distance between the center of the circle and the line y=x+2 or y-x-2=0.
The distance between a point and a line is |ax0+by0+c| / √(a2+b2)
where the line has equation ax+by+c =0 and the point is at (x0,y0)
We have y-x-2=0 and O(2,-1). So a = -1, b = 1, c = -2, x0 = 2, y0 = -1. Plugging in those values yields
The circle has equation (x-x0)2+(y-y0)2 = d2 Plug in x0 y0 and d.