Equations involving tangent functions