trying to solve tangent problem