There is a first phase of translating the synthetic geometry into analytic / algebraic geometry.
Let us suppose that $B,D$ are located in the points with coordinates $(-1,0)$, and respectively $(1,0)$.

Then $C=C(x,y)$ is on the circle with diameter $BD$, iff its distance to the origin $(0,0)$ is one. We get thus the condition:
$$ x^2+y^2-1 =0\ . $$
The perpendicularity condition $BC\perp CD$ is written equivalently as the fact, that the slopes product is minus one:
$$ \frac{y-0}{x-(-1)}\cdot \frac{y-0}{x-(-1)} = -1\ .$$
The two conditions are obviously equivalent. It is hard to find something in sage that checks that an element is in an ideal. We may of course force the situation and type:

```
sage: R.<x,y> = QQ[]
sage: J = R.ideal( x^2 + y^2 - 1 )
sage: mBC = (y-0) / ( x-(-1) )
sage: mCD = (y-0) / ( x-(+1) )
sage: ( mBC*mCD + 1 ).numerator() in J
True
```

This is very convincing, and may make us think sage did very quickly a hard job, but after...

```
sage: ( mBC*mCD + 1 ).numerator()
x^2 + y^2 - 1
```

we can only sell the code as a joke!