Find the equation of the circle which touches the curve $x^2+xy-y^2=4$ at $(2,2)$ and the line $3x-y+6=0$ For the first curve, the slope of the tangent is $3$
Let the circle be $x^2+y^2+2gx+2fy+c=0$
Then
$$\frac{2+g}{2+f} =-3$$
$$g+3f+8=0$$
Also the equation of tangent to a circle is
$$y=mx \pm r\sqrt{1+m^2}$$
From $y=3x+6$
$m=3$ and $6=r\sqrt{10}$
$$\implies g^2+f^2 -c=\frac{18}{5}$$
Also the circle passes through $(2,2)$, so
$$4g+4f+8+c=0$$
Solving all these equations, I didn’t get the right answer.
What is wrong in my method, and is there a shorter way to solve it?

You have used the equation for tangent to a circle centred at origin but you don't know the centre is at the origin.
The tangent to $x^2+xy-y^2=4$ at $A(2,2)$ is parallel to the line $y=3x+6$. Find the point $B$ on $y=3x+6$ so that $AB$ has slope $-1/3$ i.e. $AB$ is perpendicular to the tangent and the line. The centre of the circle will lie on the midpoint of $AB$ and the radius will be the distance between $AB$ divided by $2$.
You will find $B(-1,3)$ giving the equation $(x-1/2)^2+(y-5/2)^2=2.5$.

