We know that the line y=mc +c is a tangent to the ellipse
`(x^(2))/(a^(2))+(y^(2))/(b^(2))=1`
if `C^(2)=a^(2)m^(2)+b^(2)`
Then comparing the given line `x cos theta+y sin alpha=p` with y=mx +c, we have c=`p//sin alpha,m=-cos alpha//sin alpha`
So, the given line will be a tangent if
`(p^(2))/(sin^(2)alpha)=a^(2)(cos^(2)alpha)/(sin^(2)alpha)+b^(2)`
or `p^(2)=a^(2)cos^(2)alpha+b^(2)sin^(2)alpha)`