(tanx + 1)^2 cosx expand
(tan^2x + 2tanx + 1) cosx
(tan^2x + 1 + 2tanx) cos x re-order inside the parentheses
........... tan^2x + 1 = sec^2x ..........
(sec^2x + 2tanx) cosx put everything in terms of sine, cosine
( 1/cos^2x + 2 sinx / cos x ) cosx
Distribute the cosx acroos the terms in the parentheses
( 1/cos x + 2 sin x)
secx + 2sinx