It is known that the value range of the independent variable X of a certain function is 2 less than or equal to x less than or equal to 6, and the value range of the corresponding function value y is 5 less than or equal to y less than or equal to 6 13, find the analytic expression of this function

It is known that the value range of the independent variable X of a certain function is 2 less than or equal to x less than or equal to 6, and the value range of the corresponding function value y is 5 less than or equal to y less than or equal to 6 13, find the analytic expression of this function

Let y = KX + B be a linear function
① When k = 0, it is not suitable, so K ≠ 0
② When k > 0, the primary function is an increasing function, so when x = 2, y = 5, when x = 6, y = 13, that is, 2K + B = 5, 6K + B = 13. By solving the above two equations, we can get k = 2, B = 1, so the analytic formula of the primary function is y = 2x + 1
③ When k < 0, the linear function is a decreasing function, so y = 13 when x = 2, y = 5 when x = 6, that is, 2K + B = 13, 6K + B = 5. By solving the above two equations, we can get k = - 2, B = 17, so the analytic formula of the linear function is y = - 2x + 17