Two lines y = m_1x+b_1 and y = m_2x+b_2 are perpendicular if and only if m_1 = -1/m_2
As we wish for g(x) to be perpendicular to a line with slope 3, we know that g(x) has a slope of -1/3. As we are also given that g(x) passes through the point (1, 2), we can plug these into the point-slope form of a line: y - y_1 = m(x-x_1) to get the graph y = g(x) as
y-2 = -1/3(x-1)
=> y-2 = -1/3x + 1/3
=> y = -1/3x + 7/3
:. g(x) = -1/3x + 7/3