Start with the left-hand side:
\(\frac{\sin \theta}{\sin \theta + \cos \theta} + \frac{\cos \theta}{\sin \theta - \cos \theta}\)
Find a common denominator:
\(\frac{\sin \theta (\sin \theta - \cos \theta) + \cos \theta (\sin \theta + \cos \theta)}{(\sin \theta + \cos \theta)(\sin \theta - \cos \theta)}\)
Simplify the numerator:
\(\sin^2 \theta - \sin \theta \cos \theta + \sin \theta \cos \theta + \cos^2 \theta = \sin^2 \theta + \cos^2 \theta\)
Using the Pythagorean identity \(\sin^2 \theta + \cos^2 \theta = 1\), the expression becomes:
\(\frac{1}{\sin^2 \theta - \cos^2 \theta}\)
Now consider the right-hand side:
\(\frac{\tan^2 \theta + 1}{\tan^2 \theta - 1}\)
Replace \(\tan^2 \theta\) with \(\frac{\sin^2 \theta}{\cos^2 \theta}\):
\(\frac{\frac{\sin^2 \theta}{\cos^2 \theta} + 1}{\frac{\sin^2 \theta}{\cos^2 \theta} - 1}\)
Multiply numerator and denominator by \(\cos^2 \theta\):
\(\frac{\sin^2 \theta + \cos^2 \theta}{\sin^2 \theta - \cos^2 \theta}\)
Using \(\sin^2 \theta + \cos^2 \theta = 1\), this simplifies to:
\(\frac{1}{\sin^2 \theta - \cos^2 \theta}\)
Both sides are equal, hence the identity is proven.