We have,
tan−1(√1+cosx−√1−cosx√1+cosx+√1−cosx)
⇒tan−1⎛⎜ ⎜ ⎜ ⎜⎝√1+2cos2x2−1−√1−1+2sin2x2√1+2cos2x2−1+√1−1+2sin2x2⎞⎟ ⎟ ⎟ ⎟⎠
⇒tan−1⎛⎜ ⎜ ⎜ ⎜⎝√2cos2x2−√2sin2x2√2cos2x2+√2sin2x2⎞⎟ ⎟ ⎟ ⎟⎠
⇒tan−1⎛⎜ ⎜⎝√2cosx2−√2sinx2√2cosx2+√2sinx2⎞⎟ ⎟⎠
⇒tan−1⎛⎜ ⎜⎝cosx2−sinx2cosx2+sinx2⎞⎟ ⎟⎠
⇒tan−1⎛⎜ ⎜⎝cosx2−sinx2cosx2+sinx2⎞⎟ ⎟⎠×⎛⎜ ⎜⎝cosx2−sinx2cosx2−sinx2⎞⎟ ⎟⎠
⇒tan−1⎛⎜ ⎜ ⎜ ⎜ ⎜⎝(cosx2−sinx2)2cos2x2−sin2x2⎞⎟ ⎟ ⎟ ⎟ ⎟⎠
⇒tan−1⎛⎜ ⎜ ⎜ ⎜⎝(cos2x2+sin2x2−2sinx2cosx2)cos2x2−sin2x2⎞⎟ ⎟ ⎟ ⎟⎠
⇒tan−1(1−sinxcosx)
⇒tan−1(1cosx−sinxcosx)
⇒tan−1(secx−tanx)
Hence, this is the answer.