Search code examples
functionwolfram-mathematicaareacurvewolframalpha

Find the area of two functions in wolfram mathematica


I am having problems with drawing the area which is between two curves f(X)=-(x-2)^2+4 and g(x)=x/x+1 which says that the area is in the FIRST quadrant. Then to calculate the area of the area.Here is my code in wolfram mathematica.

f[x_] = -(x - 2)^2 + 4;
g[x_] = x/x + 1;
Plot[f[x] - g[x], {x, , }]
Integrate[f[x]-g[x],{x,,}]

.Thank you


Solution

  • f[x_] := -(x - 2)^2 + 4
    g[x_] := x/x + 1
    Plot[{f[x], g[x]}, {x, -1 , 5}]
    

    enter image description here

    sol = NSolve[f[x] == g[x], x]
    

    {{x -> 0.585786}, {x -> 3.41421}}

    {a, b} = x /. sol
    

    {0.585786, 3.41421}

    Integrate[f[x] - g[x], {x, a, b}]
    

    3.77124