a circle passes through 2,1 and x+2y=1 is a tangent to it at 3,-1. Find its equation

$Let\quad the\quad equation\quad of\quad circle\quad is\quad { x }^{ 2 }+y^{ 2 }+2gx+2fy+c\quad =\quad 0\quad ---(1)\\ where\quad center\quad is\quad (-f,-g)\quad and\quad radius\quad \quad =\quad \sqrt { { f }^{ 2 }+{ g }^{ 2 }-c } \\ We\quad need\quad to\quad find\quad three\quad variables\quad f,g\quad and\quad c\quad hence\quad we\quad need\quad 3\quad equations\\ involving\quad f,\quad g\quad or\quad c.$$equation\quad 1:\quad Since\quad circle\quad pass\quad through\quad (2,1)\quad substitute\quad x\quad and\quad y\quad in\quad (1).\\ equation(2)\quad Since\quad circle\quad pass\quad through\quad (3,-1)\quad substitute\quad x\quad and\quad y\quad in\quad (1).\\ equation(3)\quad since\quad x+2y=1is\quad a\quad tangent\quad to\quad circle,\quad distance\quad of\quad center\quad (-f,\quad -g)\quad \\ from\quad radius\quad =\quad \sqrt { { f }^{ 2 }+{ g }^{ 2 }-c } \quad =\quad distance\quad of\quad center\quad (-f-g)\quad from\quad line\quad x+2y=1\\ \\ Solving\quad all\quad three\quad equations\quad will\quad give\quad the\quad required\quad f,\quad g,\quad c\quad for\quad equation\quad of\quad circle$