Expand the squares:
4 = x^2 + 6x + 9 + 4y^2 - 16y + 164=x2+6x+9+4y2−16y+16
Combine the constants and group the square terms together:
x^2 + 4y^2 + 6x - 16y + 21 = 0x2+4y2+6x−16y+21=0
Substitute rcos(theta)rcos(θ) for x and rsin(theta)rsin(θ) for y:
(cos^2(theta) + 4sin^2(theta))r^2 + (6cos(theta) - 16sin(theta))r + 16 = 0(cos2(θ)+4sin2(θ))r2+(6cos(θ)−16sin(θ))r+16=0
This is a quadratic in r, use the quadratic formula:
r = {(16sin(theta) - 6cos(theta)) +-sqrt(((6cos(theta) - 16sin(theta)))^2 - 64(cos^2(theta) + 4sin^2(theta)))}/(2(cos^2(theta) + 4sin^2(theta)))r=(16sin(θ)−6cos(θ))±√((6cos(θ)−16sin(θ)))2−64(cos2(θ)+4sin2(θ))2(cos2(θ)+4sin2(θ))