The equation #(x-1)^2+(y-1)^2=1# is the equation of a circle with center at #(1,1)# and radius #1#.
This simplifies to #x^2-2x+1+y^2-2y+1=1# or #x^2+y^2-2x-2y+1=0#
As the line is #y=mx#, let us put this value of #y# in the equation of the circle and we get,
#x^2+m^2x^2-2x-2mx+1=0# or #(1+m^2)x^2-2(1+m)x+1=0#
Hence using quadratic formula
#x=(-(-2(1+m))+-sqrt((-2(1+m))^2-4(1+m^2)))/(2(1+m^2)# or
#x=((2(1+m))+-sqrt(4(1+m)^2-4(1+m^2)))/(2(1+m^2)# or
#x=((2(1+m))+-sqrt(4+4m^2+8m-4-4m^2))/(2(1+m^2)# or
#x=(2+2m+-sqrt(8m))/(2(1+m^2)#
Now if #m=0#, we have #x=1# and #y=0# and hence, we have a tangent.
If #m<0#, there is no solution and line #y=mx# does not intersect circle.
If #m>0#, the let the two points will be #D(x_1,mx_1)# and #E(x_2,mx_2)# and distance between these points #DE# is
#sqrt((x_2-x_1)^2+(mx_2-mx_1)^2)=|x_2-x_1|sqrt(1+m^2)#.
As #x=(2+2m+-sqrt(8m))/(2(1+m^2)#, #|x_2-x_1|=(2sqrt(8m))/(2(1+m^2))=sqrt(8m)/(1+m^2)#
Hence #DE=sqrt(8m)/(1+m^2)xxsqrt(1+m^2)=sqrt((8m)/(1+m^2))#