21. Solution:
\(f(x,y) = \sqrt {x^2 + 4y^2}\)
Let the output of the equation be \(c = 1\), \(f(x,y) = c\)
= \(\sqrt {x^2 + 4y^2} = c\)
= \(\sqrt {x^2 + 4y^2} = 1\)
= \(x^2 + 4y^2 = 1\)
Above equation can be true only when \(\{x|-1\le x \le 1\}\) and \(y=0\).
Hence Domain is \([-1,1]\), \(\{x|-1\le x \le 1\}\)
Using algebra,
\(y = \sqrt \frac{1-x^2}{4}\)
For values where \(x = 1~ or~ x=-1\), \(y = 0\), however, when \(x = 0,~ y = \frac{1}{2}\).
Therefore, range is \(\left[0,\frac{1}{2}\right]\), \(\bigg\{y|0\le y \le \frac{1}{2}\bigg\}\)
When \(c=2\)
= \(\sqrt {x^2 + 4y^2} = 2\)
= \(x^2 + 4y^2 = 4\)
Above equation can be true only when \(\{x|-2\le x \le 2\}\) and \(y=0\).
Hence Domain is \([-2,2]\), \(\{x|-2\le x \le 2\}\)
Using algebra,
\(y = \sqrt \frac{4-x^2}{4}\)
For values where \(x = 2~ or~ x=-2\), \(y = 0\), however, when \(x = 0,~ y = 1\).
Therefore, range is \([0,1]\), \(\{y|0\le y \le 1\}\)
When \(c=3\)
= \(\sqrt {x^2 + 4y^2} = 3\)
= \(x^2 + 4y^2 = 9\)
Above equation can be true only when \(\{x|-3\le x \le 3\}\) and \(y=0\).
Hence Domain is \([-3,3]\), \(\{x|-3\le x \le 3\}\)
Using algebra,
\(y = \sqrt \frac{9-x^2}{4}\)
For values where \(x = 3~ or~ x=-3\), \(y = 0\), however, when \(x = 0,~ y = \frac{3}{2}\).
Therefore, range is \([0,\frac{3}{2}]\), \(\{y|0\le y \le \frac{3}{2}\}\)
When \(c=4\)
= \(\sqrt {x^2 + 4y^2} = 4\)
= \(x^2 + 4y^2 = 16\)
Above equation can be true only when \(\{x|-4\le x \le 4\}\) and \(y=0\).
Hence Domain is \([-4,4]\), \(\{x|-4\le x \le 4\}\)
Using algebra,
\(y = \sqrt \frac{16-x^2}{4}\)
For values where \(x = 4~ or~ x=-4\), \(y = 0\), however, when \(x = 0,~ y = 2\).
Therefore, range is \([0,2]\), \(\{y|0\le y \le 2\}\)
#When c = 1
yValue1 <- function(x){
return(sqrt((1-x^2)/4))
}
#When c = 2
yValue2 <- function(x){
return(sqrt((4-x^2)/4))
}
#When c = 3
yValue3 <- function(x){
return(sqrt((9-x^2)/4))
}
#When c = 4
yValue4 <- function(x){
return(sqrt((16-x^2)/4))
}
#Plot the graphs
plot(yValue1,from=-5, to=5,
main="Level Curves",
ylab="Y",
ylim=c(0,2.5),
type="l",
col="blue"
)
curve( yValue2, col="red", add=TRUE )
curve( yValue3, col="green", add=TRUE )
curve( yValue4, col="yellow", add=TRUE )
legend("topright", c("c=1", "c=2","c=3", "c=4" ),col=c("blue","red","green","yellow"), lwd=c(2.5,2.5,2.5,2.5), lty=c(1,1,1,1))