Why is $y=1/x$ a continuous function but not $y=(1/x)^2$?
I was reading Thomas' calculus which said that $y=1/x$ is a continuous function because it was continuous at every point of its domain(it not being defined at $x=0$), but then goes on to show that $1/x^2$ is discontinuous saying it is an infinity discontinuity as $x$ approaches $0$. Why doesn't the same logic apply to $y=1/x$?
The notion of continuity at $x_0$ only applies to points of the domain.
By definition, a function is said continuous if it is continuous at each point of its domain.
The notion of discontinuity does not apply only to points of the domain but also to limit point of the domain that do not belong to the domain. So a continuous function can have discontinuities, but not in points of the domain.
As an example, the function
$$
f(x)=\begin{cases}
-1, & x<0 \\
+1, & x\geq0
\end{cases}
$$
is not continuous because the limit in $0$ does not exist.
The function
$$
f(x)=\begin{cases}
-1, & x<0 \\
+1, & x>0
\end{cases}
$$
is continuous, because it is continuous in each point of its domain (note that in this case $0$ does not belong to the domain). This function has however a discontinuity in $0$.
$\frac{1}{x}$ is continuous in the domain. As zero is not in the domain, you can say $\frac{1}{x}$ is a continuous function. In Thomas' book, the example of $\frac{1}{x^2}$ is not continuous on a point, which is zero. If zero, which is not in domain of $\frac{1}{x^2}$, is exclude, you can say $\frac{1}{x^2}$ is a continuous function. If you are referring to $\mathbb R$, the natural number, then $\frac{1}{x^2}$ is not continuous.
Short answer: The same logic does apply for $y = \frac{1}{x}$.
Long answer: A continuous function is defined to have no discontinuities within its domain. Therefore, $y = \frac{1}{x}$ is a continuous function because $x = 0$ is not part of its domain. However, there is an infinite discontinuity at $x = 0$, but because $x = 0$ is not part of the function's domain, $y = \frac{1}{x}$ is still considered to be a continuous function. Using the same logic, $y = \frac{1}{x^2}$ is also a continuous function, just with a discontinuity at $x = 0$, which is not part of its domain.