Hey Momo! Hope you've been having a good school week and the spring weather is starting to kick in a bit better wherever you might be!
As far as your question, it's a good one! It comes up very often in Algebra 1, Algebra 2, and Pre-Calculus classes, as well as SAT and ACT exams!
To start, a lot of people ask why we have f(x) and g(x) notation in the first place when we cover a question like this. A good reason is that when you first start learning about functions, you only cover one function at a time (listed as y equals something). However, as you go further and further into more and more advanced math, you will cover 2, 3, or even more equations. This makes more sense then just calling every new function y, y, y, y, and y, so just know that going in!
So let's see. We still have a function written out as f(x)=x. g(x) is equivalent to this function moved up 5 units. This is usually referred to in most mathematics textbooks as a parent function and its transformation. Think of a parent function being the first equation mentioned (in this case, f(x)=x) and the transformation being the "child" equation that is a lot like the parent but not quite exactly the same.
For most equation transformations, all you need to do is usually write the function g(x) in terms of f(x), which is:
g(x) = f(x)
Anytime you are being asked to move it up 5 units, this merely involves literally just ADDING 5 (a stand-in for 5 units) in at the end of the equation:
g(x) = f(x) + 5
One of the easiest ways to check this is using a linear equation. Let's use f(x)=x+5. Here, the y-intercept is at 5 or (0,5).
If you plug in that equation into f(x) in the equivalence g(x)=f(x), then you get
g(x) = f(x) + 5
g(x) = (x+5) + 5
Notice that you can get rid of the parentheses right away and simplify.
g(x) = x + 5 + 5
g(x) = x + 10
Notice that the new y-intercept is 5 units above the original function! If you graph both equations out, you will notice that actually every single point on that infinite-length line is now 5 units up! You can also make sure to check this with your calculator or even websites like desmos.com or wolframalpha.com.
Happy math travels!