If $ f(3x-1)= 12x+5$, what is $\ x \circ f(x)$? Here, I am sharing just an example problem which is given in one of my textbooks:
$$ \ \large{ f(3x-1)=12x+5 \ , \\
x \circ f(x)= \, ? \  } \ $$
And, on below of the question, the book has shown an example solution for that:
$$ \text{Instead of } \ \mathit{x}, \ \text{if we write the inverse function of } \ \mathbf{3x-1} \, \text{;} \\ 
\large{ f(x)= 12 \times \bigg( \mathbf{ \frac{x+1}{3} } \bigg) +5  \\ 
f(x)= 4x+4+5 \\ 
f(x)= 4x+9 } $$ 
$$ \large{ x \circ f(x)= f(x) =4x+9 \\ } $$
So, why do we need to take the inverse function of that $ \ \large{3x-1} \ $ and make it equal to $ \ \large{ \mathbf{f(x)} } \, $ ? How about writing that equation something like this, which I have tried before to solve the problem:
$$ \large{ f(3x-1)= 12x+5 \\ \implies \frac{x-5}{12}= f^{-1}(3x-1) \\ 
\frac{3x-1-5}{12}= x \\ 
12x= 3x-6 \\ 
9x= -6 \\ 
x= \frac{-6}{9} \\ 
\implies \frac{-2}{3} }  $$
Could you please, show me my own mistakes and explain some about how should we approach to this kind of problems to solve? Thank you very much!...
 A: That use of the composition symbol ($\circ$) is very strange and not really correct, so I’m going to ignore it.
You’re given a composition of two functions, $f$ and the function $g(x)=3x-1$, and you’re told that $(f\circ g)(x)=f(3x-1)=12x+5$. From this you want to determine what the function $f$ alone does. That is, you want to know what $f(x)$ is in terms of $x$. 
In order to discover this, you have to set up a situation in which $f$ acts directly on $x$ in a known way. You only know what $f$ does to the outputs of the function $g$, so you have to arrange for $x$ to be an output of $g$. In other words, you want to find $\text{something}$ so that $$x=g(\text{something})\;.\tag{1}$$ One way to do this is to apply $g^{-1}$ to $(1)$ to get $$g^{-1}(x)=g^{-1}\Big(g(\text{something})\Big)=\text{something}\;.\tag{2}$$ Since $g(x)=3x-1$, $g^{-1}(x)=\frac13(x+1)$, $(2)$ is specifically $$\text{something}=g^{-1}(x)=\frac13(x+1)\;.$$ In other words, $$x=g\left(\frac13(x+1)\right)\;,$$ and 
$$\begin{align*}f(x)&=f\left(g\left(\frac13(x+1)\right)\right)\\
&=(f\circ g)\left(\frac13(x+1)\right)\\
&=12\left(\frac13(x+1)\right)+5\\
&=4(x+1)+5\\
&=4x+9\;.
\end{align*}$$
Note that the problem does not ask for a specific value of $x$ (and indeed gives you no way to calculate one): it asks you to find a certain function.
A: Suppose you have an equation of the form $f(g(x))= h(x)$, and you are trying to solve for $f(x)$.  The problem is that our input of $f$, namely $g(x)$, is some other function of $x$, and it is not clear exactly how the right-hand side depends on that input.  One strategy to overcome that problem is to treat $g(x)$ as our variable; so let's give it a new name, $y=g(x)$.  In that case, $x=g^{-1}(y)$ (if $g^{-1}$ exists), and so
$f(y)=f(g(x))=h(x)=h(g^{-1}(y))$.  Aside from the renaming of the variable, this is the approach seen in the book's solution.
Neither of the first two steps in your proposed solution are valid, and the conclusion is not related to what the question is asking.  You are trying to find a function of $x$, where the answer is expected to be some sort of algebraic formula that takes as input a variable that may take on different values.  Your answer seems to be assigning one particular value to that variable, and losing the function.
Specifically, $f(3x-1)= 12x+5$ does not imply $\frac{x-5}{12}= f^{-1}(3x-1)$.  In the more abstract formulation, $f(g(x))=h(x)$ does not imply $f^{-1}(g(x))=h^{-1}(x)$.  Rather, if $h(x)=f(g(x))$, then for the inverse of $h$ you would have $h^{-1}(x)=g^{-1}(f^{-1}(x))$. Why?  Because $h(g^{-1}(f^{-1}(x)))=f(g(g^{-1}(f^{-1}(x))))=f(f^{-1}(x))=x$.
In the next line, $f^{-1}$ disappeared, and you seem to have simply replaced $x$ with $3x+1$ and vice versa, with no justification.  Note that if $y = 3x+1$, then $x = (y-1)/3$, and you have to be consistent if you change variables.
