In order to simplify what we have here, we have to use the **Half-Angle identities** and **Sum and Difference formula**.

First of all, let's simplify #cos(theta/4-pi/2)#. Knowing that

#cos(a-b)=cosacosb+sinasinb#

#=> cos(theta/4-pi/2)=cos(theta/4)cos(pi/2)+sin(theta/4)cos(pi/2)#

#cos(theta/4-pi/2) = cos(theta/4)*0 + sin(theta/4)*1=sin(theta/4)#

#:. cos(theta/4-pi/2) = sin(theta/4)#

The Half-Angle identities state that

#{(cos(x/2)=+-sqrt((1+cosx)/2)" [1]"),(sin(x/2)=+-sqrt((1-cosx)/2)" [2]"):}#

The sign of the function we wish to have is given by the quadrant the angle #x# is in.

Let us keep simplifying the second part of the function;

#"[2]" => sin(theta/4)=+-sqrt((1-cos(theta"/"2))/2)#

#"[1]" => +-sqrt((1-cos(theta"/"2))/2)=+-sqrt((1+-sqrt((1+cos(theta))/2))/2#

#color(blue)( :. sin(theta/4)=+-sqrt((1+-sqrt((1+cos(theta))/2))/2#

Now, let's pay our focus on #sec(theta"/"4)#.

Knowing that #secx=1/cosx#, we have

#sec(theta/4) = 1/cos(theta/4)#

#"[1]" => 1/cos(theta/4) = +-1/sqrt((1+cos(theta"/"2))/2)=+-sqrt(2/(1+cos(theta"/"2))#

#"[1]" => +-sqrt(2/(1+cos(theta"/"2))) = +-sqrt(2/(1+-sqrt((1+cos(theta))/2#

#color(blue)( :. sec(theta/4) = +-sqrt(2/(1+-sqrt((1+cos(theta))/2)#

Finally, we can write #f(theta)# in terms of the unit #theta# as

#color(blue)(f(theta) = +-sqrt(2/(1+-sqrt((1+cos(theta))/2))) +-sqrt((1+-sqrt((1+cos(theta))/2))/2#

**Note:** Because we had #1-cos(theta"/"2)# in the representation of #sin(theta"/" 4)# and #1+cos(theta"/"2)# in the representation of #sec(theta"/"4)#, whenever we have + in the first expression, we will have - in the second one, such as:

#sec(theta/4) = +-sqrt(2/(1color(red)+sqrt((1+cos(theta))/2)))#

We must have

#sin(theta/4) = +-sqrt((1color(red)-sqrt((1+cos(theta))/2))/2#

And vice versa.