June 2018 Paper 2 Q23

23 For each of these two function machines, when the input is \(a\) the output is \(b\).

\(k \gt 0 \quad\) and \(\quad k \ne 1 \quad\) and \(\quad a \gt 0\)

Two function machines. First: input a, square, add 3, multiply by k, output b. Second: input a, multiply by k, square, add 3, output b

Work out an expression for \(a\) in terms of \(k\).
Give your answer in its simplest form. [6 marks]