# Error when integrating with constants?

I'm trying to integrate an ellipse: (x^2)/alpha^2) + ((y^2)/beta^2) = 1. I am not sure if I should have insert constants for alpha and beta or if there's a way to keep them there.

This is my code

f[x_, y_] := ((x^2)/3) + ((y^2)/4) = 1;
Integrate[f[x, y], x, y]


Should my integral output simply be xy? I want to find the exact area enclosed by the ellipse

• Your single = is wrong. That means assignment. Did you mean == ? Also I don't see an integral anywhere in your code. Also what function are you integrating over the ellipse? Or are you trying to find the ellipse perimeter? And are you integrating over the ellipse boundary or the lamina? May 19, 2021 at 17:46
• I think I meant =. I incorrectly copied my code and just corrected it. I simply want to find the area enclosed by the ellipse mentioned and I think that'd involve integration. May 19, 2021 at 17:54
• Frankly, it seems to me that you're confused about the mathematics, what an integral is, how to compute area inside a loop — and not just struggling with the code. Explaining the first is beyond the scope of this site (or at least mine), but here's a code that gives you your desired answer: Area[ImplicitRegion[((x^2)/3) + ((y^2)/4) <= 1, {x, y}]]. May 19, 2021 at 17:57
• Hi Michael, I am definitely confused. How would I go about finding the area if 3 and 4 were any positive number constants? I arbitrarily chose those numbers. May 19, 2021 at 18:30
• Hi, something like this, Area[ImplicitRegion[((x^2)/a^2) + ((y^2)/b^2) <= 1, {x, y}], Assumptions -> a > 0 && b > 0], gives the right answer. [Site tip: Use @user, like @MichaelE2, when you reply to a constant, and the user will be notified. The author of a post is always notified of any comment except their own.] May 20, 2021 at 4:26

Your are dealing with an implicit function. One possibility is to solve it for x, then you get 2 function and you integrate the difference:

eq = ((x^2)/alpha^2) + ((y^2)/beta^2) == 1;
fun[x_] = y /. Solve[eq, y]


For an example, we need some values for alpha and beta:

fun1[x_] = fun[x] /. {alpha -> 2, beta -> 1}
Plot[fun1[x], {x, -2, 2}]


For the integrand we need to subtract the second part of fun1 from the first part:

fun2[x_]= - Subtract[fun1[x]]


and for the area:

Integrate[fun2[x], {x, -2, 2}]
(* 2 Pi *)


this is equal to: Pi alpha beta, the ellipse area formula.

Note, it is not always easy to solve an implicit equation for one of the variables. Therefore, this method has is not general.

A second way:

We may use polar coordinates. Then the radius is given by:

r[phi_] = alpha beta/Sqrt[(beta Cos[phi])^2 + ( alpha Sin[phi])^2]


And for an example we again set alpha=2 and beta=1:

 r[phi_] =
alpha beta/Sqrt[(beta Cos[phi])^2 + ( alpha Sin[phi])^2] /. {alpha ->
2, beta -> 1}

ParametricPlot[r[phi] {Cos[phi], Sin[phi]}, {phi, 0, 2 Pi}]


The area element in polar coordinates is:

dA= r[phi]^2 /2  dphi


and the area:

Integrate[r[phi]^2/2, {phi,0,2Pi}]


what gives again: 2Pi

The area enclosed by the ellipse is a Disk

rgn = Disk[{0, 0}, {Sqrt[3], 2}];

RegionQ[rgn]

(* True *)


To display the ellipse and the enclosed area

Show[
ContourPlot[((x^2)/3) + ((y^2)/4) == 1,
{x, -Sqrt[3], Sqrt[3]}, {y, -2, 2},
ContourStyle -> Red] (* ellipse *),
RegionPlot[rgn, BoundaryStyle -> None] (* enclosed area *),
AspectRatio -> Identity]


The area of the region is given by either Area or RegionMeasure

{Area[rgn], RegionMeasure[rgn]}

(* {2 Sqrt[3] π, 2 Sqrt[3] π} *)


Or more generally,

{Area[Disk[{0, 0}, {a, b}]], RegionMeasure[Disk[{0, 0}, {a, b}]]}

(* {a b π, a b π} *)