A tangent to the ellipse x2a2+y2b2=1 cuts the axes in A and B respectively and touches the ellipse at any point P in the first quadrant so that P divides AB into two equal parts. Find the equation of the tangent. Also, in case P divides AB in the ratio 3:1, find the equation of tangent.