How to get the value of a function dependant on $\tan A = \frac{2+\cot \left(\frac{B}{2}\right)}{4+\cot \left(\frac{A}{2}\right)}$? The problem is as follows:

Find the value of:
$$R=\frac{\sec^2B-\cot A}{4+\csc^2 A}$$
Where $A$ is given by:
$\tan A = \frac{2+\cot \left(\frac{B}{2}\right)}{4+\cot
> \left(\frac{A}{2}\right)}$
Also assume this follows the relationship seen in the figure from
below:


The alternatives given in my book are as follows:
$\begin{array}{ll}
1.&\frac{1}{2}\\
2.&1\\
3.&\frac{1}{4}\\
4.&\frac{1}{3}\\
\end{array}$
My main issue with this problem is the half angle which is presented in the right side of this equation:
$\tan A = \frac{2+\cot \left(\frac{B}{2}\right)}{4+\cot \left(\frac{A}{2}\right)}$
I was able to spot that the figure might intend to say that $A$ and $B$ are complementary thus:
$A+B=90^{\circ}$
Therefore this makes the previous expression into:
$\tan A = \frac{2+\tan \left(\frac{A}{2}\right)}{4+\cot \left(\frac{A}{2}\right)}$
This helps a bit but again the half angle would produce a square root. I tried to follow such path. But it didn't ended very well.
After squaring and using other identities I ended up having a 8th degree equation. And certainly this wasn't intended.
So what's the trick here?. So far I'm still stuck and all sorts of manipulations don't give me results. Can someone guide me in the right path?. I'm also confused on how to better use the figure. Those other letters don't seem to help much.
It would really help me alot a method explained step by step so I can understand.
 A: We will use the identity: $$\cot (A/2) = \csc A + \cot A$$
We will equate
$$(4+\cot(A/2))\tan A = 4\tan A + \csc A \tan A + \cot A \tan A = 4\tan A + \sec A + 1$$
with
$$2+\cot(B/2) = 2+\csc B + \cot B = 2 + \sec A + \tan A$$
as given. (Here we used $A+B = 90^\circ.$) Hence $1 = 3\tan A \implies \tan A = 1/3$.
Using the diagram, we have $b = 3a$ and $c = \sqrt{10} a$. Using this information we can easily determine $\sec B$, $\cot A$ and $\csc A$; thus:
$$\frac {\sec^2 B - \cot A}{4+\csc^2 A} = \frac {\sqrt{10}^2 - 3}{4+\sqrt{10}^2}=\frac12$$
A: Alternative approach
Using the diagram and half-angle formulas:
$$\cot(A/2) = \frac{1 + \cos(A)}{\sin(A)}
~~\text{and}~~ \cot(B/2) = \frac{1 + \cos(B)}{\sin(B)} = \frac{1 + \sin(A)}{\cos(A)} \implies $$
$$\frac{\sin(A)}{\cos(A)} = \frac{2 + \frac{1 + \sin(A)}{\cos(A)}}{4 + \frac{1 + \cos(A)}{\sin(A)}} =
\frac{2\cos(A) + 1 + \sin(A)}{4\sin(A) + 1 + \cos(A)} \times 
\frac{\sin(A)}{\cos(A)} \implies$$
$$2\cos(A) + 1 + \sin(A) = 4\sin(A) + 1 + \cos(A) \implies$$
$$\cos(A) = 3\sin(A)\implies$$

*

*$\displaystyle \cot(A) = 3$

*$\displaystyle 10\sin^2(A) = 1.$
Therefore,
$$R = \frac{\frac{1}{\cos^2(B)} - 3}{4 + \frac{1}{\sin^2(A)}}
= \frac{\frac{1}{\sin^2(A)} - 3}{4 + \frac{1}{\sin^2(A)}}
= \frac{10-3}{4 + 10} = \frac{1}{2}.$$
A: Let $\displaystyle t = \tan\frac{A}{2} \quad → 
\tan\frac{B}{2} = \tan \left(45°\!-\frac{A}{2}\right) = \frac{1-t}{1+t}$
$\displaystyle \tan A = \frac{2+\cot\frac{B}{2}}{4+\cot\frac{A}{2}} \;\; → 
\frac{2t}{1-t^2} = \frac{2+\frac{1+t}{1-t}}{4+\frac{1}{t}}\;\; → 1-t^2 = 6t
\;\; →\cot A = \frac{6t}{2t} = 3$
$\displaystyle R = \frac{\csc^2 A - \cot A}{\csc^2 A + 4}
= \frac{(3^2+1)-3}{(3^2+1)+4}
= \frac{1}{2}
$

For comparison, we solve for $\cot(A)$ with cotangent sum of angles formula.
I think it is easier to remember, negated reciprocal of tangent formula.
Trig identity: $\;\displaystyle \cot(x±y) = - \frac{1 ∓ \cot(x)\cot(y)}{\cot(x) ± \cot(y)}$
Let $\displaystyle c = \cot\frac{A}{2} \quad → 
\cot\frac{B}{2} = \cot \left(45°\!-\frac{A}{2}\right) = - \frac{1+c}{1-c}$
$\displaystyle \tan A = \frac{2+\cot\frac{B}{2}}{4+\cot\frac{A}{2}} \;\; → 
-\frac{2c}{1-c^2} = \frac{2-\frac{1+c}{1-c}}{4+c}\;\; → c^2-1 = 6c
\;\; →\cot A = \frac{6c}{2c} = 3$
