Math Problem Statement
y=|x–1|+4
Solution
Define the function y = |x - 1| + 4 def f(x): return np.abs(x - 1) + 4
Generate y values
y = f(x)
Create the plot
plt.figure(figsize=(6,6)) plt.plot(x, y, label=r'$y = |x - 1| + 4$', color='b')
Highlight the vertex and intercepts
plt.scatter(1, 4, color='red', zorder=5, label="Vertex (1, 4)")
Labels and title
plt.axhline(0, color='black',linewidth=1) plt.axvline(0, color='black',linewidth=1) plt.xlim(-10, 10) plt.ylim(-5, 15) plt.title(r'Graph of $y = |x - 1| + 4$') plt.xlabel('x') plt.ylabel('y') plt.legend()
Show the plot
plt.grid(True) plt.show()Here is the graph of the function . Key points to observe:
- The vertex is at , which is the lowest point of the "V" shape.
- The graph is shifted 1 unit to the right and 4 units up compared to the basic absolute value function .
- The graph opens upwards with a slope of 1 for ( x >
Ask a new question for Free
By Image
Drop file here or Click Here to upload
Math Problem Analysis
Mathematical Concepts
Absolute Value Functions
Graphing
Formulas
y = |x - h| + k
Theorems
Vertex of an Absolute Value Function
Transformation of Functions
Suitable Grade Level
Grades 7-9