Reverse engineering cost functions

Hi, I have a problem where a cost function is given with attributes y: output, w: the cost of labour l and r: the cost of capital k .

THe question involves to find the corresponding production function from a given cost function. I can do the cost minimization problem when one says that :

f(k,l)=y (constraint) and C(k,l)=wl+rk

To find the cost function we simply need to use lagrange multipliers, find the cost minimizing capital and labour, and insert them in the cost function, which then becomes the minimizing cost function:

c(y,w,r)= ......

I can't figure out how to do the opposite though.

Statring from

c1(y,w,r,) = (y/2)*(w+r)

and

c2(y,w,r)= 2y*sqrt(wr)

can you explain to me how to find the corresponding production functions f1 and f2?

Thanks :)

EDIT:

I found the two functions. Correct me if i'm wrong:

f1(l,k)= 2*min{l,k}

f2(l,k)=l^1/2 * k^1/2

my approach was however trial and error with a bit of intuition. Does anyone have a systematic way of finding them?